in reply to Error log clarification needed...

The code in the tutorial that you link uses newFromJpeg and not newFromJpegData. What happens if you restore newFromJpeg?

Update: ikegami points out below why this won't work either, and gives a suggestion for a fix.