Re: Validating ImageField width and height in admin site

2008-09-20 Thread Frantisek Malina
Example code > > def clean_image(self): > > from django.core.files.images import get_image_dimensions > > image = self.cleaned_data['image'] > > w, h = get_image_dimensions(image) > > if w > 640: > > raise forms.ValidationError(u'That image is too wide.') > > return im

Re: Validating ImageField width and height in admin site

2008-09-20 Thread Frantisek Malina
http://code.djangoproject.com/browser/django/trunk/django/utils/images.py?rev=3 On Sep 20, 4:19 pm, Nick <[EMAIL PROTECTED]> wrote: > Anybody?  I can't find a simple example of this anywhere so any help > would be great :) > > Nick --~--~-~--~~~---~--~~ You receive

Re: Validating ImageField width and height in admin site

2008-09-20 Thread Nick
Anybody? I can't find a simple example of this anywhere so any help would be great :) Nick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@goog

Validating ImageField width and height in admin site

2008-09-09 Thread Nick
Hi, I'm looking to validate my ImageField images in the admin site. If they are a specific size, then the whole record will save - if they are not, then the user will be returned to the form with a validation error message. I've seen get_image_dimensions, but I'm not sure how this would be used