I had an interesting issue hit my site recently, that I still can’t figure out WHY it happened, but after a few days of troubleshooting, I have figured out what happened, and how to fix it.
First, let me say that my site runs on a Mac Mini running Mavericks (10.9.5). So, all of this MAY come down to some update Apple released recently, I’m really unsure. I also run my site behind Cloudflare, which I also was curious about. It seems to have cropped up on/around the time Wordpress 4.2 was released, which is what I thought the issue was at first (and why I was involved in the wordpress.org forum thread here). The issue is basically that Wordpress, in my case, wouldn’t generate thumbnails for JPG image uploads, but PNGs would. The issue cropped up right around the time that wordpress 4.2 was released, so the natual causation logic seemed to point to Wordpress being the issue. Interestingly, it wasn’t. After banging my head on this for a while, a coworker finally found a note that Wordpress defaults to using ImageMagick (imagick.so) for image processing if it’s present, otherwise it uses GD. So, I found a “plugin” that forces Wordpress to use GD, and that fixed it. So crap, the issue is my ImageMagick install. The problem is, Wordpress is failing silently, and not throwing ANY errors.
So, I added a simple script to test imagick using some code I found on php.net hoping it would actually throw an error. And it did throw an error:
PHP Fatal error: Uncaught exception 'ImagickException' with message 'Wrong JPEG library version: library is 70, caller expects 90
There we go. So, the issue is ImageMagick is being compiled against libjpeg version 9, but when it’s going to run, it’s being handed version 7. So, I was able to do an “mdfind” and see I had version 9 and 8 installed, as well as 7, both in /usr/local/lib, and with my PHP install. So, knowing I installed both 8 and 9, I removed 8 and 9, so only 7 was avaible, and then recompiled ImageMagick, and uninstall and reinstall imagick.so. Then, I ran my test, and it worked!