Today I noticed this:
`
{28926:Fri, 17 Jan 2014 01:37:09 GMT}
WARNING: imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error: Warning: unknown JFIF revision number 2.01
in /home/public_html/gallery/zp-core/lib-GD.php on line 91
imagecreatefromjpeg called from zp_imageGet (lib-GD.php [91])
from cacheImage (functions-image.php [197])
`
And thought 'Why is that loading GD?' so I went in to admin > Options > Images and checked. Lo:
Graphics support: PHP GD library bundled (2.1.0 compatible)
supporting: gif, jpg, jpeg, png, bmp
Well that's funny, I thought I checked ImageMagick. Went to the page, yes it was checked. But it clearly wasn't being detected. phpinfo showed it, checked that WordPress was able to use it (yep), but not ZenPhoto. Thinking back, I determined the LAST time I knew it had worked was before I upgraded PHP to 5.4.23.
So since 5.4.24 was out, for CentOS, I upgraded to that. Ripped out ImageMagick, reinstalled it and Imagick, again they still show on phpinfo AND work with WP (sorry, it's the only other thing I know of to test with right now). 'identify -version' shows the correct settings.
Zenphoto version 1.4.5.8
Imagick is 3.2.0RC1
ImageMagick is 6.8.7-4 2013-11-02 Q16
Other than downgrading PHP (which I'm not really chuffed about trying), is there another way to see why ZenPhoto would allow me to check the box, but not actually be using it. If ImageMagick really was broken, why would it work in other places?
Installed this:
http://stackoverflow.com/a/11538932/894076here:
http://jorjafox.net/test/image.phpAlso my 'test' on WP was to use this:
https://github.com/markoheijnen/Debug-Image-editorsWhich shows the images as expected, and then says "WP_Image_Editor_Imagick" is my current image editor. Which implies it IS installed just fine, thank you
Suggestions welcome!
Comments
The last time I took a look at it, the WordPress extension to use Imagick/ImageMagick will fall back on the ImageMagick executable directly if Imagick is unavailable. So the WordPress extension will work as long as ImageMagick is correctly installed and accessible on your system.
You do say that Imagick shows up in `phpinfo`, but it might be worth double-checking that it's actually loaded at ZenPhoto's run time. Beyond that, nothing looks out of place from the info you've provided and from the brief look through ZenPhoto's code.
If you feel up to debugging the issue yourself, here's a quick rundown of the order for how the graphics library is loaded (for what's currently in the `master` branch).
`functions-basic`, lines 220-231; ZenPhoto will iterate through an array of potential graphics libraries (in order of preference). If the checkbox option for Imagick is set, then ZenPhoto will attempt to load Imagick first. It will go through the array until it finds a graphics lib that satisfies the condition that the function `zp_graphicsLibInfo` exists.
`lib-Imagick`, line 91; when attempting to load Imagick, `lib-Imagick` checks that Imagick is a valid option. If Imagick is present and either the checkbox option for Imagick is set or GD is not available, then `lib-Imagick` will load its functions.
The check for if Imagick is present is done in `lib-Imagick`, lines 12-32. The script checks both Imagick and ImageMagick and makes sure that they are present and the required versions are met.
I don't know how to see IF it loaded.
`zp-core/functions-basic.php` on line 224 I changed it to this:
`
$try = array('lib-Imagick.php', 'lib-NoGraphics.php');
`
And it said I had no graphics installed. So theory is that it's calling the file but not loading. I made a copy of the lib-Imagick.php file and put it outside of ZP: https://gist.github.com/Ipstenu/bded16dfc8a05fd48cab
It's stripped down to JUST the check, and then the foreach, and then I dumped out the array to see what I got.
`
Array ( [Library] => Imagick [Library_desc] => PHP Imagick library 3.2.0RC1
ImageMagick 6.8.7-4 2013-11-02 Q16 http://www.imagemagick.org [BMP] => jpg [BMP2] => jpg [BMP3] => jpg [GIF] => gif [GIF87] => gif [JPEG] => jpg [JPG] => jpg [PNG] => png [PNG24] => png [PNG32] => png [PNG8] => png [TIFF] => jpg [TIFF64] => jpg )
`
So .. that LOOKS like PHP is seeing everything fine?
http://jorjafox.net/test/test2.php is that page.
Is it possible the RC is throwing this off?
lib-Imagick.php line 91
`if ($_zp_imagick_present && (getOption('use_imagick') || !extension_loaded('gd'))) {` fails
`if ($_zp_imagick_present && getOption('use_imagick') ) {` fails
`if ($_zp_imagick_present ) {` WORKED
And by 'worked' what I mean is it showed me both the right display on admin AND it processed the image properly so I know it's working and not lying to me.
I searched the DB for 'use_imagick' and instead? Found freakin `use_Imagick`
I brute forced that back to lower cases and NOW IT WORKS.
So ...
1) How the flipping flip did THAT happen!?
2) Why would checking and unchecking the box for Imagick in settings NOT fix it? (yes, I did that a bazillion times)
(I haven't looked at the code, but this is just a guess.)