You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feel free to create a new Pull request if you want to propose a new feature.
If you need development support or want to discuss with other developers
join us in the channel #sorl-thumbnail at freenode.net or Gitter.
For releases updates and more in deep development discussion use our mailing list
in Google Groups.
The tests should run with tox. Running tox will run all tests for all environments.
However, it is possible to run a certain environment with tox -e <env>, a list of all environments
can be found with tox -l. These tests require the dependencies of the different engines defined in
the documentation. It is possible to install these dependencies into a vagrant image with the
Vagrantfile in the repo.
See more examples in the section Template examples in the Documentation
Model Usage
Using the ImageField that automatically deletes references to itself in the key
value store and its thumbnail references and the thumbnail files when deleted.
Please note that this is only compatible with django 1.2.5 or less.:
from django.db import models
from sorl.thumbnail import ImageField
class Item(models.Model):
image = ImageField(upload_to='whatever')
See more examples in the section Model examples in the Documentation
Low level API
You can use the 'get_thumbnail':
from sorl.thumbnail import get_thumbnail
from sorl.thumbnail import delete
im = get_thumbnail(my_file, '100x100', crop='center', quality=99)
delete(my_file)
Alternatively, you load the templatetags by {% load sorl_thumbnail %}
instead of traditional {% load thumbnail %}. It's especially useful in
projects that do make use of multiple thumbnailer libraries that use the
same name (thumbnail) for the templatetag module:
Possible related to the implementation of your Amazon S3 Backend, see the issue #351
due the storage backend reviews if there is an existing thumbnail when tries to
generate the thumbnail that makes an extensive use of the S3 API
A fast workaround if you are not willing to tweak your storage backend is to set: