PLEASE READ: This module is deprecated (yes, already). I found a better (unmaintained) one shortly after I created this one. I forked it over there: https://github.com/un1t/django-resized
SizedImageField is a Django field which will automatically resize image to fit a defined dimension. Because it inherits from ImageField, all the usual ImageField attributes are available. It uses PIL which is already a requirement to use Django ImageField.
from sizedimagefield.fields import SizedImageField
class Article(models.Model):
thumbnail = SizedImageField('thumbnail', width=150, height=150, upload_to='articles/')It has only been tested with Django 1.11 and Python 3.6.
Installing from pypi (using pip).
pip install django-sizedimagefield
Installing from github.
pip install -e git://github.com/makinacorpus/django-sizedimagefield.git#egg=django-sizedimagefield
Add sizedimagefield in your INSTALLED_APPS:
INSTALLED_APPS = [
'sizedimagefield',
[...]
]
The application doesn't have any special requirement.
Please see the LICENSE file.