InMotion Hosting Support Center

Issue with GD JPEG

Category: Wordpress

three_hit_shutout
Asked:
2014-01-29 1:46 am EST

Hits: 1,576
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!

You must login before you can ask a follow up question.

You must login before you can submit an answer.

OTHER ANSWERS

0

JeffMa
Staff
11,186 Points
2014-01-29 10:56 am EST
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?

You must login before you can post a comment about this answer.

Well I'll be, that *was* the page producing the GD errors (http://dousset.joeunander.com/jewellery/engagement-rings/eva/), but now...it's not. As in, that page was producing that error last Friday up through today, and now it's magically vanished. I'm happy, I guess, although a little baffled. It's like when you finally go to the doctor, and your cough stops the minute you walk into the waiting room.

Unless you have any insight into this odd behavior, please feel free to close this out. Thanks!
three_hit_shutout
11 Points
2014-01-29 11:10 am EST
I'm glad it's now working for you. There were not any changes on the server recently so I'm not sure what could have caused it to now start working. If you happen to see it again, let us know. I'll be happy to take a further look for you if it happens again.
JeffMa
11,186 Points
Staff
2014-01-29 11:49 am EST
Hi - I just wanted to follow up on this in case somebody ever runs into the same problem. I actually figured out the issue: I had password protected the domain (as it's a dev site), and when I took the password down, this issue went away (that's how it "magically" dissappeared). So clearly that was the problem. At some point it would be nice to find a work around that let's me maintain the password protection, if I figure that out I'll make sure to post it here.

Thanks again for your help!
three_hit_shutout
11 Points
2014-02-24 12:17 pm EST
Like this Question?

Forum Login

You are NOT logged in. You can still browse our Support Center.

To participate within our Community Support Forum:

Need more Help?

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!