Commits

Dominik Ruf committed c0c054e

make image src urls absolute (svglib must also be patched)

Comments (0)

Files changed (2)

collective.editablesvg.egg-info/PKG-INFO

 Metadata-Version: 1.0
 Name: collective.editablesvg
-Version: 0.2a
+Version: 0.3a
 Summary: A Plone content type for SVG graphics, that is editable through the web.
 Home-page: https://bitbucket.org/domruf/collective.editablesvg
 Author: Dominik Ruf

collective/editablesvg/svgimage.py

 def generatePng(contentobject):
     svgrenderer = SvgImageMapRenderer()
     svgxml = xml.dom.minidom.parseString(contentobject.svg.encode('ascii', 'xmlcharrefreplace'))
+    for i in svgxml.getElementsByTagName('image'):
+        url = i.getAttribute('xlink:href')
+        if not url.startswith('http://'):
+            i.setAttribute('xlink:href', contentobject.absolute_url() + '/' + url)
     svgrenderer.render(svgxml.documentElement)
     contentobject.htmlImageMap = svgrenderer.renderHtmlImageMap()
     drawing = svgrenderer.finish()