I am using sorl-thumbnail via the thumbnail
template tag in my Django templates, as follows:
{% thumbnail foo.imgA "1600x1200" as im %}
<a href='{{ im.url }}' title='{{ foo.imgA.url }}'>
{% endthumbnail %}
The original file name contains some information that is relevant to my users in case they download it. When I resize the image using sorl-thumbnail, the resized image gets a new name.
Is there a way for the sorl-thumbnail-generated image to keep the name of the original file (perhaps appending "-thumb"), or to rename the file using code in the template? (I would like to leave the model alone.)
Yes it is possible by creating your own backend based on the default one and overload the
_get_thumbnail_filename
method.For example, something like this
Then you must activate this new backend in your project
settings.py
I hope it helps