pythondjangoimagekitdjango-imagekit

Django Imagekit processing the original image


With version 1.1 I don't understand how I can preprocess the original image (by JUST using imagekit)

https://github.com/jdriscoll/django-imagekit/blob/develop/README.rst

Having a model like this:

class Photo(models.Model):
   original = models.ImageField(etcetera)
   thumbnail = ImageSpec(etcetera)

How do I for instance resize the original image? This was possible in previous imagekits, however the documentation insinuates I need another modelfield?


Solution

  • You can use ProcessedImageField:

    from imagekit.models import ProcessedImageField
    
    class Photo(models.Model):
        original = ProcessedImageField(etcetera)
    

    There is in-code documentation on this class, but it looks like it's not being picked up by readthedocs' autodoc module right now.

    I reopened a bug to fix the documentation.