Generate images thumbnails through new rendering function to handle SVG files
authorThierry Florac <thierry.florac@onf.fr>
Tue, 19 Jun 2018 17:14:27 +0200
changeset 710 c770464c85a3
parent 709 4f6cca33ed8b
child 711 ba9ae51da2a5
Generate images thumbnails through new rendering function to handle SVG files
src/pyams_content/component/paragraph/zmi/pictogram.py
--- a/src/pyams_content/component/paragraph/zmi/pictogram.py	Tue Jun 19 17:13:44 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/pictogram.py	Tue Jun 19 17:14:27 2018 +0200
@@ -39,6 +39,7 @@
     BaseParagraphPropertiesEditForm, BaseParagraphAJAXEditForm
 from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
 from pyams_content.reference.pictograms.zmi.widget import PictogramSelectFieldWidget
+from pyams_file.zmi.image import render_image
 from pyams_form.form import AJAXAddForm, ajax_config
 from pyams_form.security import ProtectedFormObjectMixin
 from pyams_i18n.column import I18nAttrColumn
@@ -227,7 +228,7 @@
         if pictogram is not None:
             image = II18n(pictogram).query_attribute('image', request=self.request)
             if image:
-                return '<img src="{0}" />'.format(absolute_url(image, self.request, '++thumb++48x48'))
+                return render_image(image, 48, 48, self.request)
         return '--'