diff --git a/CHANGES.rst b/CHANGES.rst index 9a874a8e..18751ea1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,7 +10,9 @@ New: Fixes: -- *add item here* +- Workarround for method getImageSize. + Prevent returning (-1, -1) as the size of the image. + [andreesg] 3.0.5 (2015-11-26) diff --git a/plone/namedfile/file.py b/plone/namedfile/file.py index 5c86215f..61eeac38 100644 --- a/plone/namedfile/file.py +++ b/plone/namedfile/file.py @@ -463,4 +463,9 @@ def getFirstBytes(self, start=0, length=IMAGE_INFO_BYTES): def getImageSize(self): """See interface `IImage`""" + if (self._width, self._height) != (-1, -1): + return (self._width, self._height) + + res = getImageInfo(self.data) + contentType, self._width, self._height = res return (self._width, self._height)