richardbarran / django-photologue

A customizable plug-in photo gallery management application for the Django web framework.
BSD 3-Clause "New" or "Revised" License
676 stars 238 forks source link

issue with photo sizes not created (PIL/Pillow conflict #170

Closed 60north closed 7 years ago

60north commented 7 years ago

I have met with the same problem as many people before me - in virtualenv environment with pillow installed smaller photo sizes where not created when new image added.

I was able to identify the source of the problem. In short, if you use from PIL import Image instead of import Image all works fine. In models.py code there's a try-catch that tries first to import Image and then PIL import Image. First one succeeds. When create_size() tries to load the image for resize, it gets IOError: cannot identify image file which is quietly swallowed by create_size() for some reason.

quick google shows it is a known problem in pillow, i do not have time now (project deadline), does anybody want to look it up? i just commented the first half of imports to deploy on production, but it is a bad bad solution, of course.

here's a pull in pillow with similar problem https://github.com/python-pillow/Pillow/pull/1898

richardbarran commented 7 years ago

Hi, The try-catch in models.py is really old code, IIRC it was due to an issue importing from PIL on some distributions (Ubuntu? maybe). I've removed it all (master branch), on the assumption that everyone uses Pillow nowadays and that the importing issues have all be resolved. Can you test the master branch and check if your issue with smaller photo sizes has been resolved?

60north commented 7 years ago

yep, it's gone now.

richardbarran commented 7 years ago

Thanks for checking it. I will now close this issue.