From 9a8626a668faeb7f4cfcc32fe4a2cae3ae61f9cb Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Fri, 16 Apr 2010 15:38:32 +0000 Subject: [PATCH] Protection from scale error svn: r15165 --- src/plugins/webreport/NarrativeWeb.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/plugins/webreport/NarrativeWeb.py b/src/plugins/webreport/NarrativeWeb.py index d0b4daef1..729706a10 100644 --- a/src/plugins/webreport/NarrativeWeb.py +++ b/src/plugins/webreport/NarrativeWeb.py @@ -2690,10 +2690,14 @@ class MediaPage(BasePage): (width, height) = ImgManip.image_size(orig_image_path) max_width = self.report.options['maxinitialimagewidth'] max_height = self.report.options['maxinitialimageheight'] - scale_w = (float(max_width)/width) or 1 # the 'or 1' is so that - # a max of zero is ignored + if width != 0 and height != 0: + scale_w = (float(max_width)/width) or 1 # the 'or 1' is so that + # a max of zero is ignored - scale_h = (float(max_height)/height) or 1 + scale_h = (float(max_height)/height) or 1 + else: + scale_w = 1.0 + scale_h = 1.0 scale = min(scale_w, scale_h, 1.0) new_width = int(width*scale) new_height = int(height*scale)