PHP GD Jpeg Error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
JustinMs66
Forum Contributor
Posts: 127
Joined: Sun Sep 03, 2006 4:18 pm

PHP GD Jpeg Error

Post by JustinMs66 »

when i try to use:

Code: Select all

imagecreatefromjpeg($filename)
i get this error:

Code: Select all

gd-jpeg: JPEG library reports unrecoverable error: in filename.
I have GD 2.0.34 installed with PHP 5.2.10, and when i print gd_info(), it says [JPG Support] => 1 just as PNG and GIF support, but only JPG won't work!

I have been through every possible article that google gives me about this error with no success.

i tried setting this in php.ini, with no effect:

Code: Select all

gd.jpeg_ignore_warning = 1
I tried installing GD 2.0.36 manually to overwrite the other GD = no change

I tried installing GD 2.0.36 manually to another location and specifying that location when i configure php, which resulted in a different error:

Code: Select all

filename is not a valid JPEG file
I tried manually installing libjpeg and specifying that manually when i configured php = no change

Does anyone know how to fix this?
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: PHP GD Jpeg Error

Post by onion2k »

Have you tried specifying a file instead of using $filename? Eg "image.jpg".
User avatar
JustinMs66
Forum Contributor
Posts: 127
Joined: Sun Sep 03, 2006 4:18 pm

Re: PHP GD Jpeg Error

Post by JustinMs66 »

of course, my code is not the problem, the exact code works fine on my other server. i used $filename in this thread to substitute for the real one.
congo
Forum Newbie
Posts: 2
Joined: Tue Aug 18, 2009 1:50 pm

Re: PHP GD Jpeg Error

Post by congo »

hello,

I get the same error:

Code: Select all

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error: in /usr/local/www/index.php on line 160
i know its not the code. And i too tried to update my gd and jpeg libraries.
Im running FreeBSD 7.1, with Apache22, with PHP 5.2.10 and gd version: bundled (2.0.34 compatible).
I recently upgraded the PHP compiler from a younger version 5.2.8, and it seems that after that upgrade the gd cannot use the function imagecreatefromjpeg. I havent tried gif or png since i dont use them.

The upgrade of GD didnt do the job for now. I have been wondering if i should either recompile PHP again, or maybe reinstall GD. I too am confident that the code is NOT the problem, and it is NOT the input to the function called.

It occured to me that this was also an issue in PHP4, and that was around 2001-2005. Yet this problem exists all of a sudden in PHP5 in 2009. Could it be a returning bug, or would it be an administrative issue (compile).



best regards
congo, denmark
congo
Forum Newbie
Posts: 2
Joined: Tue Aug 18, 2009 1:50 pm

Re: PHP GD Jpeg Error

Post by congo »

as i was investigating the issue at my end, i found this in the global apache22 error log:

Code: Select all

Wrong JPEG library version: library is 70, caller expects 62
I found it right after posting the other post, just before, sorry about that.

I backs up my assumption that it is a compilation / software issue.

After a few investigations on my server, i did deinstall the gd lib from the php5-extensions on freebsd. I use the make command.

I had to actually remove some files manually, and force overwrite when reinstalling, to make sure some older versions was not accepted rather than reinstalling the new ones. I use the make tool for this, and everything worked well - i fetch php and the extensions from the freebsd ports tree.

my issue is now eliminated, and i hope someone can use this as inspiration in similar issues :)


/br congo, denmark
Post Reply