sorl/sorl-thumbnail — Issue #91: Geometry should be maximum for both width and height
Author: chrisdpratt
Created: 2012-03-07 22:35:33+00:00
State: open

When you specify a geometry such as "100x100" and crop of "noop", the smallest of the width or height is scaled to 100px and then the other is set proportionately, even if it's greater than 100px.

For example, let's say I had an image that was 1024x768. With the settings above, the thumbnail would be sized at 133x100.

I think it's far more logical for the geometry to be a bounding box, such that the thumbnail in the above scenario would end up being 100x75. This can still be achieved using the `is_portrait` filter, but it requires the following *very* verbose code:

{% if photo|is_portrait %}
{% thumbnail photo "x100" crop="noop" as im %}

{% endthumbnail %}
{% else %}
{% thumbnail photo "100" crop="noop" as im %}

{% endthumbnail %}
{% endif %}

However, I understand that changing the behavior of this now might affect current end-user implentations, so perhaps an additional option could be added to the tag as a switch -- something along the lines of ` {% thumbnail photo "100" crop="noop" constrain=True as im %}` would work fine.