Question

I have many images with arbitrary heights and widths ( 2033x1957, 1560X980, ...). When i use sorl-thumbnail for these images in order to resize them to be 160x160 i don't get these exact sizes. I get images with sizes like 160x120, 120x160... Is there a constrain proportion option(like in photoshop) in sorl-thumbnail in order to get the exact 160x160 size?

Was it helpful?

Solution

you can use the crop option. this will use as much as possible of the source image and cut off slices at the sides to match the exact resolution you want while not stretching the image.

{% thumbnail myimage "160x160" crop="center" %}

see http://thumbnail.sorl.net/examples.html for more examples and optional parameters to crop

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top