Uploaded my photos (jpg) and using zenphoto for a month now and things are going quite smoothly.
But some photos were not automatically rotated, guess it's just lack some kind informations by a specific camera for zenphoto to do so.
Anyway, I downloaded the photos and rotate them manually using digiKam and reuploaded. To my surprise, the thumbnails of the updated images cannot be displayed, only the full-size image are.
I tried to refresh the metadata, refresh the database, clear the cache ... and none of these actions solved the problem. By accident, found the `error.log` which specify
`Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: '.../xxx.jpg' is not a valid JPEG file in ... on line 71
`
Tried to display the "invalid" image with other softwares and all are displaying the files. So I compared local files and remote files and they are identical byte by byte. Finally, after much research and some readings, realized it was a problem specific to gd/php and added the following line to `zp-config.php` and all photos thumbnails are magically displayed!
`ini_set("gd.jpeg_ignore_warning", 1);`
Not sure what's the exact source of the problem, nor whose fault is (digiKam or gd or php). All I understand is it just make the zenphoto code more fault tolerant with minor difference in jpg support. Spent so much time reading the forum that I think this could be useful for other zenphoto users.
Comments
As to fault tollerance--Zenphoto did continue, it just did not display the image which was reported in error by the GD library. Seems like that is the proper behavior to me.
And sorry I did not expressed myself clearly about fault tolerance, I meant more fault tolerant to the zenphoto user standpoint. I finally understood my issue was specific to GD, and GD have an explanation about unsupported jpg headers between softwares, etc. From the front-end, I am still a zenphoto user finding a way to get my images displayed.
But as I know my images are not "that bad", all I did was rotating them, so I choose to temporarily ignore the warnings. Even though it is not the best solution, it's good to know that such a workaround could help
Will try to install Imagick and see if there's a difference in behaviour.
Thank you for your support.
Zenphoto does infact trap GD errors if they occur. But of course if GD merely issues an error message without faulting there is nothing to trap. Again, not much we can do about that. The image will not display and no one knows why without looking at the error logs. What more can be done?
We really do not consider it advisable to ignore warnings even though it did get you around this specific problem. Should we do that, the next person who has a problem will not even get the error message which might help him figure it out.
So I asked my provider to install Imagick and it works great with all the images. Seems to be a better alternative.
PHP Imagick library 3.0.1
ImageMagick 6.2.8 10/20/10 Q16
Either way your code worked perfectly - thanks for this!!