Commit edab29e1 authored by Alexandre Boeglin's avatar Alexandre Boeglin

include ERP5.Document.Image API when getting image width and height


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13764 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4da7b901
...@@ -339,9 +339,12 @@ xmlns:config="http://openoffice.org/2001/config" office:version="1.0"> ...@@ -339,9 +339,12 @@ xmlns:config="http://openoffice.org/2001/config" office:version="1.0">
w, h, maxwidth, maxheight = getLengthInfos( options_dict, ('width','height','maxwidth','maxheight') ) w, h, maxwidth, maxheight = getLengthInfos( options_dict, ('width','height','maxwidth','maxheight') )
try: try: # try image properties
aspect_ratio = float(picture.width) / float(picture.height) aspect_ratio = float(picture.width) / float(picture.height)
except (TypeError, ZeroDivisionError): except (TypeError, ZeroDivisionError):
try: # try ERP5.Document.Image API
aspect_ratio = float(picture.getWidth()) / float(picture.getHeight())
except AttributeError: # fallback to Photo API
aspect_ratio = float(picture.width()) / float(picture.height()) aspect_ratio = float(picture.width()) / float(picture.height())
# fix a default value and correct the aspect # fix a default value and correct the aspect
if h is None: if h is None:
......
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