sorl-thumbnail 13.5.0 lets your code catch a source image that can't be read, fixes thumbnail cleanup for storages that no longer exist, and needs Python 3.11 or later. Each change is explained in full in the changelog.
Highlights
- Catch a source that can't be read.
get_thumbnail(..., raise_errors=True)raises the error from the storage or the engine, usually anOSError, so you can show your own fallback. In thethumbnailtag,raise_errors=Truerenders the{% empty %}block, or raises withTHUMBNAIL_DEBUGon. Before, a missing file was only logged and you got back a thumbnail that was never written. All engines. #644 - Python 3.11 or later. Python 3.10 reached its end of life in October 2026, and Pillow 13.0.0, which fixes 43 security advisories, needs Python 3.11. On Python 3.10, pip keeps installing 13.4.0.
Fixes
manage.py thumbnail cleanupno longer stops when a storage was removed or renamed, withImproperlyConfigured: Error importing moduleorValueError: not enough values to unpack. Records whose storage no longer exists are removed, since their files can't be reached. #423- The convert engine, with ImageMagick or GraphicsMagick, no longer leaves an empty file in the temp directory each time a source can't be read.
Before you upgrade
- On Python 3.10: nothing breaks, pip stays on 13.4.0. Upgrade to Python 3.11 or later to get new releases and the patched Pillow.
- If
thumbnail cleanupstopped with one of the errors above: runpython manage.py thumbnail cleanupagain.
Coming in 14.0
get_thumbnailwill raise by default when the source can't be read, and thethumbnailtag will render{% empty %}. Until then you get aFutureWarningwhen it happens. Passraise_errors=Trueto switch now, orraise_errors=Falseto keep today's behaviour without the warning. Docs
Links
- Documentation: https://sorl-thumbnail.readthedocs.io/
- Quickstart: https://sorl-thumbnail.readthedocs.io/en/latest/quickstart.html
- Troubleshooting: https://sorl-thumbnail.readthedocs.io/en/latest/troubleshooting.html
- Examples: https://mariocesar.github.io/sorl-thumbnail/
- Changelog: https://github.com/mariocesar/sorl-thumbnail/blob/13.5.0/CHANGES.rst
- PyPI: https://pypi.org/project/sorl-thumbnail/13.5.0/
- Report a bug: https://github.com/mariocesar/sorl-thumbnail/issues/new/choose
Full Changelog: 13.4.0...13.5.0