matthewwithanm / django-imagekit

Automated image processing for Django. Currently v4.0
http://django-imagekit.rtfd.org/
BSD 3-Clause "New" or "Revised" License
2.26k stars 276 forks source link

How can I define imagekit spec from CreateView and UpdateView in Django 2.0 #467

Open rousseauu opened 6 years ago

rousseauu commented 6 years ago

How can provide width and height dynamically from form field:

class PostForm(forms.ModelForm):
    image = ProcessedImageField(spec_id='posts:create:post_image',
                                processors=[ResizeToFill(width=600, height=400)],
                                format='JPEG',
                                options={'quality': 80})
    width_field = forms.IntegerField()
    height_field = forms.IntegerField()