Ticket #8307: images.1.diff

File images.1.diff, 995 bytes (added by sebastian.serrano@…, 11 years ago)
  • images.py

     
    2121
    2222    def _get_image_dimensions(self):
    2323        if not hasattr(self, '_dimensions_cache'):
    24             self._dimensions_cache = get_image_dimensions(self)
     24            if self.field.width_field and self.field.height_field:
     25                width = getattr(self.instance, self.field.width_field)
     26                height = getattr(self.instance, self.field.height_field)
     27                #check if the fields have proper values
     28                if isinstance(width,int) and isinstance(height,int):
     29                    self._dimensions_cache = (width, height)
     30                else:
     31                    self._dimensions_cache = get_image_dimensions(self)
     32            else:
     33                self._dimensions_cache = get_image_dimensions(self)
    2534        return self._dimensions_cache
    2635
    2736def get_image_dimensions(file_or_path):
Back to Top