Ticket #1901: image_width_height.diff
File image_width_height.diff, 992 bytes (added by , 19 years ago) |
---|
-
django/db/models/base.py
341 341 _save_FIELD_file.alters_data = True 342 342 343 343 def _get_FIELD_width(self, field): 344 return self._ _get_image_dimensions(field)[0]344 return self._get_image_dimensions(field)[0] 345 345 346 346 def _get_FIELD_height(self, field): 347 return self._ _get_image_dimensions(field)[1]347 return self._get_image_dimensions(field)[1] 348 348 349 349 def _get_image_dimensions(self, field): 350 350 cachename = "__%s_dimensions_cache" % field.name 351 351 if not hasattr(self, cachename): 352 352 from django.utils.images import get_image_dimensions 353 filename = self._ _get_FIELD_filename(field)()353 filename = self._get_FIELD_filename(field) 354 354 setattr(self, cachename, get_image_dimensions(filename)) 355 355 return getattr(self, cachename) 356 356