Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

travis pypi coveralls

Thumbnails for Django.

Features at a glance

  • Support for Django 1.4, 1.5 and 1.6

  • Python 3 support (for Django 1.5 and Django 1.6)

  • Storage support

  • Pluggable Engine support for Pillow, ImageMagick, PIL, Wand and pgmagick

  • Pluggable Key Value Store support (cached db, redis)

  • Pluggable Backend support

  • Admin integration with possibility to delete

  • Dummy generation (placeholders)

  • Flexible, simple syntax, generates no html

  • ImageField for model that deletes thumbnails

  • CSS style cropping options

  • Back smart cropping, and remove borders from the images when cropping

  • Margin calculation for vertical positioning

  • Alternative resolutions versions of a thumbnail

Read more in the documentation (latest version)

Developers

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-thumnbnail at freenode.net

irc://irc.freenode.net/#sorl-thumbnail

Or join us in Gitter.im

https://gitter.im/mariocesar/sorl-thumbnail

How to Use

Get the code

Getting the code for the latest stable release use ‘pip’.

$ pip install sorl-thumbnail

Install in your project

Then register ‘sorl.thumbnail’, in the ‘INSTALLED_APPS’ section of your project’s settings.

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.admin',
    'django.contrib.sites',
    'django.contrib.comments',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.contenttypes',

    'sorl.thumbnail',
)

Templates Usage

All of the examples assume that you first load the thumbnail template tag in your template.:

{% load thumbnail %}

A simple usage.

{% thumbnail item.image "100x100" crop="center" as im %}
    <img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
{% endthumbnail %}

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.:

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)

See more examples in the section Low level API examples in the Documentation

Metadata

Release files for sorl-thumbnail 11.12.1b

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sorl-thumbnail 11.12.1b
File Size Uploaded Provenance Actions
sorl-thumbnail-11.12.1b.tar.gz 62.3 kB Without provenance Details for sorl-thumbnail-11.12.1b.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for sorl-thumbnail 11.12.1b
File Interpreter ABI Platform Actions
sorl_thumbnail-11.12.1b-py33-none-any.whl Python 3.3 none any Details for sorl_thumbnail-11.12.1b-py33-none-any.whl
sorl_thumbnail-11.12.1b-py27-none-any.whl Python 2.7 none any Details for sorl_thumbnail-11.12.1b-py27-none-any.whl

Total release size: 135.6 kB

Release files / sorl-thumbnail-11.12.1b.tar.gz

Download URL sorl-thumbnail-11.12.1b.tar.gz
Size 62.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6b309388f4c4fbbeec6813ccb3c321ba3245ef2b7de044ed7b26853ec75c05f3
BLAKE2b-256 checksum
How to use checksums
c4a11eda1a4675e4e61f8044a0a75a12af7399209e20294e9bee6a824d056f52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / sorl_thumbnail-11.12.1b-py33-none-any.whl

Download URL sorl_thumbnail-11.12.1b-py33-none-any.whl
Size 36.7 kB
Tags Python 3.3
SHA-256 checksum
How to use checksums
fe6e832952365c5cd98dfb84f44fce5a34db66eebb053ac4ba6502cc2ab694d0
BLAKE2b-256 checksum
How to use checksums
c50bf8949597bde8dd14a0a775d8a965fb4c4dabae3394e0824726a3562b26bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / sorl_thumbnail-11.12.1b-py27-none-any.whl

Download URL sorl_thumbnail-11.12.1b-py27-none-any.whl
Size 36.7 kB
Tags Python 2.7
SHA-256 checksum
How to use checksums
e4ead059b02684e62cfa0d2c870da22416fe3245d9eb0ac33af0a0ce8bd30da6
BLAKE2b-256 checksum
How to use checksums
e00dcad99b4e972fcf95a319e15e4ad7edc5d102ae16847c9ccfefc09191ae9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for sorl-thumbnail 11.12.1b

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page