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): ...@@ -124,17 +124,18 @@ class OOOdCommandTransform(commandtransform):
'mimetypes_registry').lookup(content_type) 'mimetypes_registry').lookup(content_type)
format = image_parameter_dict.pop('format', None) format = image_parameter_dict.pop('format', None)
for mimetype_object in mimetype_list: if not format:
if mimetype_object.extensions: for mimetype_object in mimetype_list:
format = mimetype_object.extensions[0] if mimetype_object.extensions:
break format = mimetype_object.extensions[0]
elif mimetype_object.globs: break
format = mimetype_object.globs.strip('*.') elif mimetype_object.globs:
break format = mimetype_object.globs.strip('*.')
break
if getattr(image, 'meta_type', None) == 'ERP5 Image': if getattr(image, 'meta_type', None) == 'ERP5 Image':
#ERP5 API #ERP5 API
# resize image according parameters # 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 = OFSImage(image.getId(), image.getTitle(), image_data)
# image should be OFSImage # 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