Ticket #8307: images.py.2.diff

File images.py.2.diff, 750 bytes (added by Alan Justino da Silva, 13 years ago)

Let the storage backend disable touching the image file to get height/width

  • core/files/images.py

     
    2121
    2222    def _get_image_dimensions(self):
    2323        if not hasattr(self, '_dimensions_cache'):
    24             close = self.closed
    25             self.open()
    26             self._dimensions_cache = get_image_dimensions(self, close=close)
     24            if getattr(self.storage, 'IGNORE_IMAGE_DIMENSIONS', False):
     25                self._dimensions_cache = (0,0) # Too costly to hit the file?
     26            else:
     27                close = self.closed
     28                self.open()
     29                self._dimensions_cache = get_image_dimensions(self, close=close)
    2730        return self._dimensions_cache
Back to Top