Hi there, I have this error on http://www.site.com/admin/content/types/ctname/fields/field_name
field_name - is a image field type. One user have reported, that he was unable to upload image.


    warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg, libjpeg: recoverable error: Premature end of JPEG file in .../sites/all/modules/imageapi/imageapi_gd.module on line 59.
    warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: 'sites/default/files/dsc05833_0.jpg' is not a valid JPEG file in .../sites/all/modules/imageapi/imageapi_gd.module on line 59.

There are 3 line in error log for this activity


Details
Type	imagecache
Date	Wednesday, September 5, 2012 - 17:30
User	Neprihlásený
Location	http://www.site.com/sites/default/files/imagecache/thumb/dsc05833_0.jpg
Referrer	http://www.site.com/michalovce?page=7
Message	Failed generating an image from dsc05833_0.jpg using imagecache preset thumb.
Severity	error
Hostname	62.*.*.108
Operations

Details
Type	php
Date	Wednesday, September 5, 2012 - 17:30
User	Neprihlásený
Location	http://www.site.com/sites/default/files/imagecache/thumb/dsc05833_0.jpg
Referrer	http://www.site.com/michalovce?page=7
Message	imagecreatefromjpeg() [<a href='function.imagecreatefromjpeg'>function.imagecreatefromjpeg</a>]: 'sites/default/files/dsc05833_0.jpg' is not a valid JPEG file in sites/all/modules/imageapi/imageapi_gd.module on line 59.
Severity	error
Hostname	62.*.*.108
Operations	

Details
Type	php
Date	Wednesday, September 5, 2012 - 17:30
User	Neprihlásený
Location	http://www.site.com/sites/default/files/imagecache/thumb/dsc05833_0.jpg
Referrer	http://www.site.com/michalovce?page=7
Message	imagecreatefromjpeg() [<a href='function.imagecreatefromjpeg'>function.imagecreatefromjpeg</a>]: gd-jpeg, libjpeg: recoverable error: Premature end of JPEG file in sites/all/modules/imageapi/imageapi_gd.module on line 59.
Severity	error
Hostname	62.*.*.108
Operations	

Comments

chinita7’s picture

I saw the same error on admin/reports/dblog.

There were 3 error on the same time from the same user.

magecreatefromjpeg() [<a href='function.imagecreatefromjpeg'>function.imagecreatefromjpeg</a>]: 'sites/default/files/imagefield_profile/2012/10/2263_m/tumblr_lrfegs9ldY1qecky5o1_500.jpg' is not a valid JPEG file in /public_html/sites/all/modules/imageapi/imageapi_gd.module on line 59.

Division by zero in /public_html/sites/all/modules/imageapi/imageapi.module on line 221.

The selected image handling toolkit can not correctly process _image_close.

arx-e’s picture

Same error here

error	php	31/10/2012 - 16:13	Division by zero in ...	92012501	
error	php	31/10/2012 - 16:13	imagecreatefromjpeg() [<a ...	92012501	
error	php	31/10/2012 - 16:13	imagecreatefromjpeg() [<a ...	92012501	
error	imageapi	31/10/2012 - 16:13	The selected image handling toolkit can ...	92012501	
error	php	31/10/2012 - 16:13	Division by zero in ...	92012501	
error	php	31/10/2012 - 16:13	imagecreatefromjpeg() [<a ...	92012501	
error	php	31/10/2012 - 16:13	imagecreatefromjpeg() [<a ...	92012501	
error	imageapi	31/10/2012 - 16:13	The selected image handling toolkit can ...	92012501	
error	php	31/10/2012 - 16:13	Division by zero in ...	92012501	
error	php	31/10/2012 - 16:13	imagecreatefromjpeg() [<a ...	92012501	
error	php	31/10/2012 - 16:13	imagecreatefromjpeg() [<a ...	92012501	
error	imageapi	31/10/2012 - 16:12	The selected image handling toolkit can ...	92012501

It seems it happens while trying to resize photos from a mobile phone - maybe damaged files? Or a certain jpg flavor that the gd can not handle?

I've seen a similar message in photoshop yesterday with a jpg file photoshop would not open and I open/saved the file from another application and then all was OK.
Any ideas?

chinita7’s picture

The user encountered this error reported me that he/she was using Safari on Mac so I don't think this comes from just mobile phones. (Not confirmed)

arx-e’s picture

Case solved for me. The culprits were two somehow damaged jpg files.
I downloaded the 2 files, opened/resaved them and re-uploaded and the error reports stopped.
One of the files had visible damage (some blocks of the image lost and some other displaced) the other one I only managed to open in Corel Photo Paint as Photoshop refused saying the file was damaged.
Anyway, it seems anytime the page was loaded the system tried and failed to resize the damaged images and a triad of errors were generated, resulting in hundreds of error reports.