Skip to content

MechanisM/django-cropduster

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image uploading/cropping tool for Django.  Integrates into the Django admin with an image file field, 
and then size sets are created to correspond with the thumbnails to be created.  On image upload, 
it prompts to define a crop area and zoom for each aspect ratio from the size set. Includes template 
tag to display images on the front end, and allows to delay thumbnail creation until first request 
in template for rarely used thumbnails.  

Requires Python Image Library (with PNG support for use with PNG files)

Usage:

1. In models.py, define a field as a Cropduster image field (it uses a different field type to override 
the default widget):

from cropduster.models import CropDusterField, Image as CropDusterImage

class Model():
    image = CropDusterField(CropDusterImage)


2. Add Cropduster to the list of installed apps in the settings file
INSTALLED_APPS = (
...
    'cropduster',
...
)


3. Run syncdb or a South migration to create the database tables

4. Run the server and go into the Django admin, go into the Cropduster section for Size Sets.  Here 
You create the set of image sizes for use with your app.  Use different size sets with different apps.  
Select "Crop on request" for images that should not be created until they are first requested. "Auto size" 
means that the system will not ask for a crop to be defined to create the thumbnail, but will simply be created
automatically (cropping form 0x0 to image size, and then sizing down)


5. In the admin.py for your app, override the default widget for that field, and define which size set to use
by the handle of the size set.

from cropduster.widgets import AdminCropdusterWidget
from cropduster.models import CropDusterField

class ModelAdmin(admin.ModelAdmin):
    formfield_overrides = {
      	CropDusterField: {"widget": AdminCropdusterWidget("size-set-handle")}
    }

About

Image uploader and cropping tool to create thumbnails at various aspect ratios

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published