Commit 50fe0035 authored by Bartek Górny's avatar Bartek Górny

handle zero-size image

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19567 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bf9ef05a
......@@ -419,6 +419,7 @@ class Image(File, OFSImage):
width = self.getWidth()
height = self.getHeight()
(width, height) = self._getAspectRatioSize(width, height)
if (width, height) == (0, 0):return self.getData()
return self._resize(display, width, height, quality, format=format,
resolution=resolution, frame=frame)
......@@ -447,6 +448,8 @@ class Image(File, OFSImage):
def _getAspectRatioSize(self, width, height):
"""Return proportional dimensions within desired size."""
img_width, img_height = (self.getWidth(), self.getHeight())
if img_width == 0:
return (0, 0)
if height > img_height * width / img_width:
height = img_height * width / img_width
else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment