#8307: ImageFile doesn't use the width_field and height_field for cache
--------------------------------------------------+-------------------------
Reporter: [EMAIL PROTECTED] | Owner: jacob
Status: assigned | Milestone: 1.0
Component: File uploads/storage | Version: SVN
Resolution: | Keywords: imagefile
height width
Stage: Accepted | Has_patch: 1
Needs_docs: 1 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------------------+-------------------------
Changes (by Gulopine):
* needs_docs: 0 => 1
Comment:
This is a tough one. On one hand, I can appreciate the performance gain of
using the cache fields, since they're already available, and they *should*
always be in sync with what's on the file. But I can't help thinking that
I like the idea of `ImageFile.width` and `ImageFile.height` always
returning the actual dimensions of the file, no matter what.
If they used the cache fields and those ever get out of sync with the file
itself (which is possible any number of ways, depending on your
application), the only way to get the true dimensions would be to use
`django.core.files.images.get_image_dimensions` manually. And, after all,
isn't the point of having properties for width and height to avoid having
to call that manually? Plus, using `get_image_dimensions` directly means
you'll have to cache those values manually if you expect to need them more
than once.
I suppose I'm -0 on this ticket; someone with a decent argument might be
able to sway me. Either way, though, I think the docs could be a bit more
explicit about where the `width` and `height` values come from.
--
Ticket URL: <http://code.djangoproject.com/ticket/8307#comment:6>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---