Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Automated image processing for Django
Python
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
photoprocessor
tests
.gitignore
.travis.yml
AUTHORS
LICENSE
MANIFEST.in
README.rst
requirements.txt
setup.py
tox.ini

README.rst

https://secure.travis-ci.org/cuker/django-photoprocessor.png?branch=master

django-photoprocessor

Step 1

$ pip install django-photoprocessor

(or clone the source and put the photoprocessor module on your path)

Step 2

Add ImageWithProcessorField to your models.

# myapp/models.py

from django.db import models
from photoprocessor.fields import ImageWithProcessorsField

thumbnails = {'thumbnail':{'resize':{'width':100, 'height':100, 'crop':'center'}, 'quality':90},
              'display': {'resize':{'width':500, 'height':500, 'crop':'center'}, 'quality':90}}

class Photo(models.Model):
    name = models.CharField(max_length=100)
    original_image = ImageWithProcessorsField(upload_to='books', thumbnails=thumbnails)

Step 3

Access your thumbnails

photo = Photo(name='myphoto')
photo.original_image.save('myfile.jpg', myfileobj)
print photo.original_image['thumbnail'].url
Something went wrong with that request. Please try again.