Skip to content
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="{{ content.mediafile.file|thumbnail:"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.

Clone this wiki locally