{"id":5916,"library":"easy-thumbnails","title":"Easy Thumbnails for Django","description":"Easy Thumbnails is a powerful yet user-friendly Django application designed for generating and managing image thumbnails. It dynamically creates thumbnails based on a source image, supports predefined aliases, and integrates seamlessly with Django models and templates. The library is actively maintained, with the current stable version being 2.10.1, and releases occurring regularly to support new Django and Python versions.","status":"active","version":"2.10.1","language":"en","source_language":"en","source_url":"http://github.com/SmileyChris/easy-thumbnails","tags":["django","thumbnails","image-processing","web"],"install":[{"cmd":"pip install easy-thumbnails","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core dependency for the web framework.","package":"Django","optional":false},{"reason":"Image processing library (implicit dependency).","package":"Pillow","optional":false},{"reason":"Optional dependency for SVG image thumbnailing support.","package":"reportlab","optional":true}],"imports":[{"symbol":"ThumbnailerImageField","correct":"from easy_thumbnails.fields import ThumbnailerImageField"},{"symbol":"get_thumbnailer","correct":"from easy_thumbnails.files import get_thumbnailer"},{"note":"While {% load thumbnail %} is common, if conflicting with other thumbnail libraries, use {% load easy_thumbnails_tags %} to avoid clashes.","wrong":"{% load thumbnail %}","symbol":"template_tag_load","correct":"{% load thumbnail %}"}],"quickstart":{"code":"import os\n\n# settings.py\nINSTALLED_APPS = [\n    # ...\n    'easy_thumbnails',\n]\n\nTHUMBNAIL_ALIASES = {\n    '': {\n        'avatar': {'size': (50, 50), 'crop': True},\n        'profile_square': {'size': (200, 200), 'crop': 'smart'},\n    },\n}\n\n# models.py\nfrom django.db import models\nfrom easy_thumbnails.fields import ThumbnailerImageField\n\nclass Profile(models.Model):\n    user = models.OneToOneField('auth.User', on_delete=models.CASCADE)\n    photo = ThumbnailerImageField(upload_to='profile_photos', blank=True, null=True)\n\n    def __str__(self):\n        return self.user.username\n\n# In a Django template (e.g., profile.html)\n# {% load thumbnail %}\n# <img src=\"{{ profile.photo|thumbnail_url:'avatar' }}\" alt=\"{{ profile.user.username }} avatar\" />\n\n# Or, with custom options directly in template\n# {% load thumbnail %}\n# <img src=\"{% thumbnail profile.photo 100x100 crop %}\" alt=\"Profile photo\" />\n\n# In Python code\n# from easy_thumbnails.files import get_thumbnailer\n# profile_instance = Profile.objects.get(pk=1)\n# if profile_instance.photo:\n#     thumbnailer = get_thumbnailer(profile_instance.photo)\n#     avatar_url = thumbnailer['avatar'].url\n#     print(f\"Avatar URL: {avatar_url}\")\n\n# Run migrations after adding to INSTALLED_APPS and defining models:\n# python manage.py migrate easy_thumbnails","lang":"python","description":"After installing and adding 'easy_thumbnails' to `INSTALLED_APPS`, run migrations. Define thumbnail aliases in `THUMBNAIL_ALIASES` in your `settings.py` for reusable thumbnail configurations. Integrate `ThumbnailerImageField` into your models. In templates, load the `thumbnail` tags and use the `thumbnail_url` filter with an alias, or the `thumbnail` tag with explicit size and options. For programmatic access, use `get_thumbnailer`."},"warnings":[{"fix":"Upgrade Python to 3.9+ and Django to 4.2+ (Django 5.1+ supported).","message":"Version 2.10.0 dropped support for Python 3.8 and Django 4.1 and earlier. Ensure your project meets the new minimum requirements.","severity":"breaking","affected_versions":">=2.10.0"},{"fix":"Remove these settings from your `settings.py`. Review documentation for retina/high-DPI display handling if previously used.","message":"Version 2.8.0 removed the `THUMBNAIL_HIGH_RESOLUTION` and `THUMBNAIL_HIGHRES_INFIX` settings. High-resolution support is now handled differently, if still needed, consult the latest documentation for alternatives.","severity":"breaking","affected_versions":">=2.8.0"},{"fix":"Use `{% load easy_thumbnails_tags %}` instead of `{% load thumbnail %}` for `easy-thumbnails` in your templates to avoid conflicts.","message":"If you use multiple thumbnailing libraries (e.g., `sorl-thumbnail` and `easy-thumbnails`) in the same project, the default `{% load thumbnail %}` template tag might clash.","severity":"gotcha","affected_versions":"all"},{"fix":"Enable `THUMBNAIL_SAVE_DIMENSIONS = True` in your `settings.py` to store thumbnail dimensions in the database, reducing calls to remote storage.","message":"When using remote storage backends (e.g., S3), fetching image dimensions can be slow. This can impact performance for pages rendering many thumbnails.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure your Pillow library is up-to-date and review any custom image processing logic for compatibility with newer Pillow versions.","message":"Version 2.8.4 replaced deprecated Pillow constants against newer counterparts. While this is an internal change, older custom processors or direct Pillow interactions might need adjustment.","severity":"deprecated","affected_versions":">=2.8.4"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}