[Erp5-report] r19567 - /erp5/trunk/products/ERP5/Document/Image.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Feb 28 22:33:08 CET 2008


Author: bartek
Date: Thu Feb 28 22:33:08 2008
New Revision: 19567

URL: http://svn.erp5.org?rev=19567&view=rev
Log:
handle zero-size image

Modified:
    erp5/trunk/products/ERP5/Document/Image.py

Modified: erp5/trunk/products/ERP5/Document/Image.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Image.py?rev=19567&r1=19566&r2=19567&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Image.py (original)
+++ erp5/trunk/products/ERP5/Document/Image.py Thu Feb 28 22:33:08 2008
@@ -419,6 +419,7 @@
           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 @@
   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:




More information about the Erp5-report mailing list