jdriscoll / django-imagekit
Automates image processing for Django models. Resize, process and cache multiple versions of your image files. Access newly created files with a standard API. Supports alternate storage schemes such as Amazon S3.
Clone this repository (size: 135.6 KB): HTTPS / SSH
$ hg clone http://hg.driscolldev.com/django-imagekit
ImageModel
The ImageModel abstract base class is the core of ImageKit. By inheriting from this class your models are augmented with a new accessor property for each image specification you define. These accessors expose a similar API to the Django ImageField, allowing you to easily access image URLs, files and dimensions.
Lets assume we've defined the following image specification and configured our model to use it in our IKOptions inner class:
We would now be able to access this processed image using the following API:
| Property | Return Type | Description |
|---|---|---|
| instance.display.url | String | Returns the URL of the image relative to MEDIA_URL |
| instance.display.file | File object | Returns the image file as a file-like object |
| instance.display.image | PIL Image | Returns the image as a PIL Image |
| instance.display.width | Integer | Returns the image width |
| instance.display.height | Integer | Returns the image height |
This revision is from 2010-08-26 01:05
