I set up a content type that has a title, image, and body. The image uploads and displays fine to an anonymous user, but the image preview in the content type creation page gives this error upon upload:

    * warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error: in /home/brianbat/public_html/v2/modules/imageapi/imageapi_gd.module on line 44.
    * warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: 'sites/default/files/mega-music-logo.jpg' is not a valid JPEG file in /home/brianbat/public_html/v2/modules/imageapi/imageapi_gd.module on line 44.
    * warning: Division by zero in /home/brianbat/public_html/v2/modules/imageapi/imageapi.module on line 222.

Any help is appreciated. Thanks.

Files: 
CommentFileSizeAuthor
#4 DSC_2875.jpg1.69 MBbrunorios1

Comments

liveoutloud2day’s picture

I had this problem (at least the division by zero on line 222 of imageapi.module) and it was because I had migrated the site to another server that didn't have php5-gd installed

ubunutu$ sudo apt-get install php5-gd fixed it.

Hope it helps!

Liveoutloud2day

asanchez75’s picture

thanks. It works for me too :)

brunorios1’s picture

i'm having problems too:

warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error: in /home/flashmed/public_html/sites/all/modules/imageapi/imageapi_gd.module on line 44.
warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: 'sites/default/files/images/jobs/dsc_2875.jpg' is not a valid JPEG file in /home/flashmed/public_html/sites/all/modules/imageapi/imageapi_gd.module on line 44.
warning: Division by zero in /home/flashmed/public_html/sites/all/modules/imageapi/imageapi.module on line 222.

GD installed in the server:

GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.2.1
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XPM Support enabled
XBM Support enabled

module version

6.x-1.10

php.ini

register_globals = Off
memory_limit = 512M
max_execution_time = 300
upload_max_filesize = 64M

uploaded file size: 1.5M

brunorios1’s picture

FileSize
1.69 MB

image:

johnbowen’s picture

liveoutloud2day's solution (in comment #1) worked for me as well. Thanks!

albertguedes’s picture

Well, the solution for me was to use png images, not jpg.

vipin.mittal18’s picture

GD is already installed on my system. I transferred my files from development to production environment.
Both the environment are same but somehow uploading image showing an error " warning: Division by zero in /web/thecabin.net/htdocs/sites/all/modules/contrib/imageapi/imageapi.module on line 221."

Please help me in this.

Thanks in advance

brianbatesd’s picture

This ended up being an issue with the library not being properly installed on my web server. I contacted my server admin (it's a shared hosting plan) and he took care of it for me (not my area of expertise).