Answer the question
In order to leave comments, you need to log in
How to use thumbnail sorl to resize while maintaining aspect ratio?
How to use thumbnail sorl to resize while maintaining aspect ratio?
Не выводит изображение. Устанавливал по документации.
{% load thumbnail %}
{% thumbnail new_item.photo "250x250" padding=True as im %}
<img src="{{ im.url }}" height="{{ im.height }}" width="{{ im.width }}">
{% endthumbnail %}
Answer the question
In order to leave comments, you need to log in
At the specified height and width, the aspect ratio of the file will not be maintained. When padding, sorl will fit the image into these 250x250 leaving white margins (or another color if specified).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question