Welcome to django-versatileimagefield’s documentation!¶
A drop-in replacement for django’s
ImageField that provides a flexible, intuitive and easily-extensible interface for creating new images from the one assigned to the field.
Click here for a quick overview of what it is, how it works and whether or not it’s the right fit for your project.
The 1.2 release dropped support for Python 3.3.x.
The 1.4 release dropped support for Django 1.5.x & 1.6.x.
The 1.7 release dropped support for Django 1.7.x.
Table of Contents¶
- Model Integration
- Specifying a Primary Point of Interest (PPOI)
- Using Sizers and Filters
- Writing Custom Sizers and Filters
- Deleting Created Images
- Django REST Framework Integration
- Improving Performance
- Added support for Django 3.1 & 3.2.
- Added github actions & txsupport. Thanks, @luzfcb!
- Added auto-publish to PyPI (on new tag creation).
- Squashed a bug that prevented calling
InMemoryUploadedFileinstances. This change will help make post processing tasks for newly uploaded images – like uploading files to S3 or other remote storage – more straight-forward. Thanks, @jxltom!
- Added Python 3.7.x compatibility. Thanks, @NyanKiyoshi!
- Added Django 2.1.x and Django REST Framework 3.8.x compatibility.
- Added Pillow 6.0.x compatibility.
- Fixed a ‘race condition’ bug that intermittently arose in some cloud storage providers which caused
VersatileImageFieldto fail when attempting to create a sized url from an image that hadn’t finished uploading. A big thanks to @camflan for the stellar work (especially the improvements he contributed to the test suite)!
- Added Django 2.0.x and Django REST Framework 3.7.x compatibility.
- Added Pillow 5.0.x compatibility.
- Updated Pillow dependency. Pillow 2.4.0 thru 4.3.0 now supported in Python 2.7, 3.4, 3.5 and 3.6.
- Excluded tests from PyPI releases (thanks, @matthiask!).
- Fixed a bug with the widget if thumbnailing failed or crashed (thanks again, @matthiask!)
- Added a note about import problems when adding a new sizer/filter in Python 2.7 (thanks, @chubz!).
- Added LICENSE to package manifest (thanks, @sannykr!).
- Fixed a bug that prevented VersatileImageField from working when
null=Truewith Django 1.11 (thanks, @szewczykmira!).
- Added support for Pillow 3.4.2
- Included JPEG resize quality to sized image keys.
VERSATILEIMAGEFIELD_SETTINGS['image_key_post_processor']setting for specifying a function that will post-process sized image keys to create simpler/cleaner filenames.
django-versatileimagefieldships with two built-in post processors:
'versatileimagefield.processors.md5_16'(more info here).
- Fixed a critical bug that broke initial project setup (i.e. when
django.setup()is run) when an app config path was included in
INSTALLED_APPS(as opposed to a ‘vanilla’ python module).
- Fixed a bug that caused
collectstaticto fail when using placeholder images with external storage, like Amazon S3 (thanks, @jelko!).
VersatileImageFieldnow returns its placeholder URL if
.urlis accessed directly (previously only placeholder images were returned if a sizer or filter was accessed). Thanks (again), @jelko!
- Fixed a bug that caused
collectstaticto fail when using
- Dropped support for Python 3.3.x.
- Added support for Django 1.9.x.
- Re-added support for Django 1.5.x (by request, support for Django 1.5.x was previously dropped in the 0.4 release). If you’re using
django-versatileimagefieldon a Django 1.5.x project please be sure to read this bit of documentation.
- Added support for Django REST Framework 3.3.x.
VersatileImageFieldSerializerto serve image URLs as absolute URIs (if its associated field’s storage class isn’t doing so already).
- Formerly: /media/headshots/jane_doe_headshot.jpg
- Now: http://localhost:8000/media/headshots/jane_doe_headshot.jpg
- Finessed/improved widget functionality for both optional and ‘PPOI-less’ fields (thanks, @SebCorbin!).
- Addressed Django 1.9 deprecation warnings (
VersatileImageFieldformfield to be overriden via
- Removed clear checkbox from widgets on required fields.
- Added support for Django 1.8.
- Numerous documentation edits/improvements.
- Squashed a bug that was throwing an
AttributeErrorwhen uploading new images.
- Squashed a bug that raised a
ValueErrorin the admin when editing a model instance with a
- Admin ‘click’ widget now works in Firefox.
django-versatileimagefieldis now available for installation via wheel.
- Squashed a bug that was causing the admin ‘click’ widget to intermittently fail
- Simplified requirements installation (which makes django-versatileimagefield installable by
editable=Falseby default to address a bug that consistently raised
ValidationErrorin ModelForms and the admin
- Squashed a bug that prevented
PPOIFieldfrom serializing correctly
- Squashed an installation bug with
- Added Python 3.3 & 3.4 compatibility
- Improved cropping with extreme PPOI values
- Squashed a pip installation bug.
- Ensuring admin widget-dependent thumbnail images are created even if
VERSATILEIMAGEFIELD_SETTINGS['create_on_demand']is set to
CroppedImagebug that was causing black stripes to appear on crops of images with PPOI values that were to the right and/or bottom of center (greater-than 0.5).
- Overhauled how
CroppedImageprocesses PPOI value when creating cropped images. This new approach yields significantly more accurate results than using the previously utilized
ImageOps.fitfunction, especially when dealing with PPOI values located near the edges of an image or aspect ratios that differ significantly from the original image.
- Improved PPOI validation
- Squashed unset
cropSizer default resample to PIL.Image.ANTIALIAS
- Added support for auto-rotation during pre-processing as dictated by ‘Orientation’ EXIF data, if available.
- Added release notes to docs
- Converted giant README into Sphinx-friendly RST
- Docs added to readthedocs
- Initial open source release