Not all thumbnails being displayed

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

  • Well, our troubleshooting guide does specifically direct you to review your CGI error logs when you are having this sort of problem. Had you done that to start you would not have spent so much time on the problem. I think in general it is not a good idea to ignore warnings. Presumably they are there for a purpose. If you have an issue with the PHP GD library then report it to them.

    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.
  • Thank you to take the time for the reply. I did consult the troubleshooting guide more than once, but guess I missed the essentials :). I did read lots of postings from the forum too.

    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.
  • I am sure you understand that if you use the GD library you have to live with its limitations. If it thinks the images are bad, then they are to it. Not anything Zenphoto can do about it.

    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.
  • I didn't mean something could be done with Zenphoto, and already appreciate Zenphoto's high quality a lot, as is.

    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
  • Indeed Imagick is the preferred graphics library. Unfortunately it is also fairly uncommon. (Even my provider does not make it available.)
  • I was just having the same problems - but only with certain images. Resized smaller and the thumbs displayed fine. It's weird because it seems to be the smaller sized original images that weren't working.

    Either way your code worked perfectly - thanks for this!!
  • acrylian Administrator, Developer
    It could also have been a metadata issue like something corrupt for some reason for example. That can break everything.
Sign In or Register to comment.