A
A
alex_deerk2016-07-10 16:21:56
Django
alex_deerk, 2016-07-10 16:21:56

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

2 answer(s)
A
Abdulla Mursalov, 2016-07-11
@amaprograma

{% thumbnail image "100x100" padding=True as im %}

I
Icic Bender, 2016-07-17
@icw82

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 question

Ask a Question

731 491 924 answers to any question