Commit df23b501 authored by Nicolas Delaby's avatar Nicolas Delaby

Honour format passed in parameters (src="image-reference?format=png")


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45088 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4c126278
......@@ -124,17 +124,18 @@ class OOOdCommandTransform(commandtransform):
'mimetypes_registry').lookup(content_type)
format = image_parameter_dict.pop('format', None)
for mimetype_object in mimetype_list:
if mimetype_object.extensions:
format = mimetype_object.extensions[0]
break
elif mimetype_object.globs:
format = mimetype_object.globs.strip('*.')
break
if not format:
for mimetype_object in mimetype_list:
if mimetype_object.extensions:
format = mimetype_object.extensions[0]
break
elif mimetype_object.globs:
format = mimetype_object.globs.strip('*.')
break
if getattr(image, 'meta_type', None) == 'ERP5 Image':
#ERP5 API
# resize image according parameters
mime, image_data = image.convert(None, **image_parameter_dict)
mime, image_data = image.convert(format, **image_parameter_dict)
image = OFSImage(image.getId(), image.getTitle(), image_data)
# image should be OFSImage
......
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