Skip to content
This repository

Automated image processing for Django

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 photoprocessor fix for constructing the form field outside of the admin April 01, 2013
Octocat-spinner-32 tests
Octocat-spinner-32 .gitignore initial commit October 11, 2011
Octocat-spinner-32 .travis.yml add travis July 17, 2012
Octocat-spinner-32 AUTHORS initial commit October 11, 2011
Octocat-spinner-32 LICENSE
Octocat-spinner-32 MANIFEST.in
Octocat-spinner-32 README.rst
Octocat-spinner-32 requirements.txt
Octocat-spinner-32 setup.py new test harness July 16, 2012
Octocat-spinner-32 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.