django-photofile is a Django app that provides template tags for thumbnail generation, supports automatic rotation based on EXIF.Orientation.
Planned routines for metadata handling (EXIF/IPTC/XMP).
Why another thumbnail app for Django?
I've looked at sorl-thumbnail and others, and initially I wanted to use an existing project, but none of them supported automatic rotation based on EXIF.Orientation.
Installation
- Alternative a) pip install django-photofile.
- Alternative b) download source, unpack and do python setup.py install.
- Alternative c) hg clone https://bitbucket.org/weholt/django-photofile and do python setup.py install.
Usage
In settings.py
- Add 'photofile' to your INSTALLED_APPS.
- Set up caching if you want.
- Add a dir to your STATICFILES_DIRS or set STATIC_ROOT.
In your template:
{% load photofile_tags %}
< img src="{% generate_thumbnail imagefile 200x300 %}"/ >
or:
< img src="{% generate_thumbnail imagefile 100x100 crop %}"/ >
Where imagefile is an object with at a property/field called:
- unique_filename or
- complete_filename or
- filename
Resolution is specified as x, for instance 200x300 and if you want to crop the photo add crop as shown in the example over.
What is new in this release:
- Some refactoring for an upcoming project.
What is new in version 0.4.0:
- Added decorator for finding screen resolution. See How-section for example.
Requirements:
- Python
- Django
- PIL
- pyexiv2
Comments not found