Skip to content

Commit

Permalink
Workarround for method getImageSize. Prevent returning (-1, -1) as th…
Browse files Browse the repository at this point in the history
…e size of the image. by andreesg
  • Loading branch information
jensens committed Dec 14, 2015
1 parent 8940e77 commit ea98fc4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions plone/namedfile/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit ea98fc4

Please sign in to comment.