django-resizer / README.md

Django Resizer

Django Resizer allows images to be dynamically resized and/or cropped through a URL. This is very useful when you have a third-party "hot-linking" your images and they won't have access to template tag to dynamically resize images like easy-thumbnails or sorl-thumbnail provides.

Installation

Run pip install django-resizer

Add resizer to your INSTALLED_APPS setting:

INSTALLED_APPS = (
    ...
    'resizer',
)

To your sites url.py add:

urlpatterns = patterns('',
    ...
    url(r'^resizer/(?P<path>.*)/$', 'resizer.views.resize', name='image_resize'),
)

Usage

The resizing and cropping capabilities rely on the easy-thumbnails app.

To resize an image with a height and width of no more than 50px and with the image ratio perserved:

/resizer/images/picture.jpg?size=50,50

The path after /resizer should be the path to the image from your settings MEDIA_ROOT. The query string should be size=[width],[height].

To resize an image to have a height and width of extactly 50px:

/resizer/images/picture.jpg?size=50,50&crop=smart

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.