Protection from scale error
svn: r15165
This commit is contained in:
parent
02d78e66ef
commit
9a8626a668
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user