sorl-thumbnail 12.2

Thumbnails for Django

Thumbnails for Django.

Features at a glance

  • Support for Django 1.4, 1.5, 1.6 and 1.7
  • Python 3 support (for Django 1.5, 1.6, 1.7)
  • 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 or Gitter.

For releases updates and more in deep development discussion use our mailing list in Google Groups.

User Support

If you need help using sorl-thumbnail browse http://stackoverflow.com/questions/tagged/sorl-thumbnail and posts your questions with the sorl-thumbnail tag.

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

BSD

Author

Mikko Hellsing

Pip

sorl-thumbnail==12.2

Classifiers

  • Topic :: Software Development :: Libraries :: Python Modules
  • Topic :: Internet :: WWW/HTTP
  • Programming Language :: Python :: 3
  • Programming Language :: Python :: 2.7
  • Programming Language :: Python
  • Operating System :: OS Independent
  • License :: OSI Approved :: BSD License
  • Intended Audience :: Developers
  • Framework :: Django
  • Environment :: Web Environment
  • Development Status :: 5 - Production/Stable
File Type Python Version Uploaded On Downloads
sorl_thumbnail-12.2-py2.py3-none-any.whl Wheel 2.7 Dec. 24, 2014 7,111
sorl_thumbnail-12.2-py2.7.egg Egg 2.7 Dec. 24, 2014 675
sorl-thumbnail-12.2.tar.gz Source Dec. 24, 2014 1,938
Version Release Date
12.2 Dec. 24, 2014
12.1c Nov. 6, 2014
11.12.1b March 28, 2014
11.12 Dec. 29, 2011
11.09.1 Nov. 6, 2011
11.09 Sept. 14, 2011
11.05.2 May 9, 2011
11.05.1 April 29, 2011
11.05 April 29, 2011
11.04 April 28, 2011
11.01 April 28, 2011
10.12.1 April 28, 2011
10.12 April 28, 2011
10.12-beta4 April 28, 2011
10.12-beta3 April 28, 2011
10.12-beta2 April 28, 2011
10.12-beta April 28, 2011
10.12-alpha April 28, 2011
3.2.5 April 28, 2011
3.2.4 April 28, 2011
3.2.3 April 28, 2011
3.2.2 April 28, 2011
3.2.1 April 28, 2011
Date Package Version Action
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 3.2.3 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 3.2.2 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 3.2.1 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 3.2.5 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 3.2.4 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 11.05.2 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 11.05.1 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 11.12.1b Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 10.12 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 11.01 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 11.04 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 11.05 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 10.12-beta Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 11.09 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 10.12.1 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 11.09.1 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 12.1c Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 10.12-alpha Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 10.12-beta3 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 10.12-beta2 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 10.12-beta4 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 12.2 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail 11.12 Release Created
Feb. 2, 2015, 2:51 a.m. sorl-thumbnail Package Created