Issue with GD JPEG

Avatar
  • Answered
Background: I'm using Color Thief PHP (https://github.com/ksubileau/color-thief-php) to determine the dominant color of a JPEG in a slider and use that to automagically update the navigation elements to use the appropriate color (as the white nav elements were getting lost on brighter images).

My set up works great on my local XAMPP-based build, however when I pushed the changes to the live dev site I'm getting the following errors:

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error: in /home/joeuna5/public_html/dousset/wp-content/themes/dousset/lib/ColorThiefPHP.php on line 329

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: 'http://dousset.joeunander.com/wp-content/uploads/2014/01/Philosophy_original-1920x700.jpg' is not a valid JPEG file in /home/joeuna5/public_html/dousset/wp-content/themes/dousset/lib/ColorThiefPHP.php on line 329

Warning: Invalid argument supplied for foreach() in /home/joeuna5/public_html/dousset/wp-content/themes/dousset/functions.php on line 247

Example here:

http://dousset.joeunander.com/jewellery/engagement-rings/eva/

You'll note on that example page I'm currently echoing the source image that's being fed into imagecreatefromjpeg(), and if you check out the source assets, they are totally there on the server. I also created these image assets in Photoshop, made sure they are 8-bit RGB, and used the "Save for Web" feature, so, ostensibly they should be valid JPEGs (although imagecreatefromjpeg appears to disagree).

Even curiouser, I set up a test page on the live site (involves another hosting company who shall remain nameless, not my idea FYI) where Color Thief PHP works without issue (the second echo is the returned dominant color values):

http://jeandousset.com/forvars/

...same Color Thief file, same function call, same image even (matches one of the images in the example slider).

So I did a little digging, and tried the stuff recommended here:

http://stackoverflow.com/questions/10611883/warning-imagejpeg-functionimagejpeg-gd-jpeg-jpeg-library-reports-unrecov

...and here:

http://stackoverflow.com/questions/3901455/the-dreaded-warning-imagecreatefromjpeg-tmp-filename-is-not-a-valid-jpe

...but neither worked.

Other stuff: I have shared hosting (although I dream of VPS); and I checked phpinfo() and GD-JPEG seems to be initiated and working. Any help with this would be *hugely* appreciated, I plan on using Color Thief PHP with future projects (and probably other apps that use imagecreatefromjpeg).

Thanks in advance!
Avatar
JeffMa
When vissiting the page you provided, I was unable to produce any errors. Could you provide me with the exact page that is producing the error?