+ def clean(self):
+ cleaned_data = super(ImageEditForm, self).clean()
+ uploaded_file = cleaned_data.get('file', None)
+ width, height = PILImage.open(uploaded_file.file).size
+ min_width, min_height = settings.MIN_COVER_SIZE
+ if width < min_width or height < min_height:
+ raise forms.ValidationError('Image too small: %sx%s, minimal dimensions %sx%s' %
+ (width, height, min_width, min_height))
+