On Fri, Jul 25, 2008 at 1:11 PM, Darthmahon <[EMAIL PROTECTED]> wrote:
> So currently there is no way of getting the dimensions for an image?

I'd call that a radical interpretation of the text. You were asking
solely about the size of the file, not the dimensions of the image.
Looking a bit at how things work at the moment, it's a bit difficult
to reliably get the dimensions on an uploaded file before saving it to
its final location. If you can save it somewhere first, you can just
use django.utils.images.get_image_dimensions() and pass in the path.

Unfortunately, when files are uploaded now, they don't necessary have
a path, and that function currently only works with files that already
exist in the filesystem. Technically, if you're using
TemporaryUploadedFile, you can use the temporary_file_path() method to
get a path you can use for get_image_dimensions(), but smaller images
will probably use InMemoryUploadedFile, which doesn't have such a
method.

For now, I'd suggest that you save the file somewhere first, check the
dimensions, and delete it immediately if it's outside your vaild
range. Once I get #5361 in, it'll be a whole lot easier to do all
this.

-Gul

--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to