-
Notifications
You must be signed in to change notification settings - Fork 238
Thumbnails
Henning Hraban Ramm edited this page May 29, 2017
·
1 revision
You can use the thumbnail function of FeinCMS’s medialibrary in your own templates:
{% load feincms_thumbnail %}
<img src="iframe.php?url=https%3A%2F%2Fgithub.com%2F%7B%7B+content.mediafile.file%7Cthumbnail%3A"200x300" }}" alt="{{ content.mediafile.translation.caption }}" />
Obviously you can set the maximum dimensions. It works not only with FeinCMS’s medialibrary but with every ImageField.
You can set FEINCMS_THUMBNAIL_DIR, this path will get appended to FEINCMS_MEDIALIBRARY_ROOT, and you’ll get a medialibrary tree below. To keep the thumbnails with the originals, set it to ''.
Have a look into feincms/templatetags/feincms_thumbnail.py for more information.
There’s also the cropscale thumbnailer that creates thumbnail that exactly fit the given size, while the thumbnail function keeps the original dimension ratio.