Sozi icon indicating copy to clipboard operation
Sozi copied to clipboard

Sozi 15: Linked Images are not displayed in editor

Open marcoklemm opened this issue 9 years ago • 9 comments

My SVG contains linked images such as the following example:

<image overflow="visible" width="3591" height="1954" 
   xlink:href="Folien/286.png"
   transform="matrix(0.1585 0 0 0.1585 51.7483 1788.0493)">
</image>

However, the images are not displayed in the editor (Sozi-15.05.142313-win64):

missing images

Steps to reproduce:

  1. Create an empty svg
  2. Link a small png
  3. Open in Sozi 15

Thanks in advance! Marco

marcoklemm avatar Jun 28 '15 02:06 marcoklemm

+1

It's great how @senshu is moving Sozi forward -- I tried to upgrade from the InkScape extension to Sozi 15 just yesterday, but the fact that linked images are not displayed was a show stopper for me.

bovender avatar Jun 28 '15 07:06 bovender

Experimental support for linked images has been added recently. You can try the latest nightly build (15.06.202222) from https://drive.google.com/open?id=0ByRUreHgekjMWG9teGM2dE8wck0&authuser=0

aumouvantsillage avatar Jun 28 '15 07:06 aumouvantsillage

Thanks a lot! Works like a charm with the latest build!

Best Regards, Marco

2015-06-28 9:44 GMT+02:00 Guillaume Savaton [email protected]:

Experimental support for linked images has been added recently. You can try the latest nightly build (15.06.202222) from https://drive.google.com/open?id=0ByRUreHgekjMWG9teGM2dE8wck0&authuser=0

— Reply to this email directly or view it on GitHub https://github.com/senshu/Sozi/issues/304#issuecomment-116212756.

marcoklemm avatar Jun 28 '15 15:06 marcoklemm

The nightly doesn't appear to work with image embeds from OmniGraffle, which are of the form:

<image xl:href="image1.png" width="1024" height="1024" transform="translate(193.5 8.5) scale(.12792969)"/>

The output HTML contains this:

<image xl:href="image1.png" width="1024" height="1024" transform="translate(193.5 8.5) scale(.12792969)"></image>

Which looks as if it ought to work but does not appear to in the browser (the original .svg does).

davidchisnall avatar Aug 23 '15 10:08 davidchisnall

Also verified that this still persists with the 15.06 release.

davidchisnall avatar Aug 23 '15 13:08 davidchisnall

This is a simple .svg created from OmniGraffle, which exhibits the problem. It expects to find image1.png in the same directory and embeds it in the svg.

(As an aside, it would also be nice to have an export option that would embed all images in the HTML as base64 encoded data and use data URIs for them, so that you can distribute the presentation as a stand-alone file)

davidchisnall avatar Sep 01 '15 13:09 davidchisnall

After a little bit of debugging, it appears that Sozi is not correctly handling XML namespaces. If the svg tag contains xmlns:xlink="http://www.w3.org/1999/xlink" and the reference to the image is xlink:href="image1.png", then it all works fine. If, however, the svg tag contains xmlns:xl="http://www.w3.org/1999/xlink" and the reference to the image is xl:href="image1.png", then Sozi doesn't understand the image.

davidchisnall avatar Sep 02 '15 14:09 davidchisnall

@davidchisnall Thanks for investigating this issue. I am trying to fix this, but it seems that there are issues in Webkit:

  • When the SVG is embedded inside an HTML document, Webkit refuses to display images if the "href" attribute is not prefixed by "xlink".
  • It still doesn't work if Sozi adds "xmlns:xlink" and "xlink:href" attributes to the document.

I have no idea at the moment, but I will try again soon.

aumouvantsillage avatar Sep 03 '15 20:09 aumouvantsillage

WebKit (at least, in Safari and Chromium on OS X) displays the image if it has foo:href, for any value of foo as long as in the svg tag has xmlns:foo="http://www.w3.org/1999/xlink" in it. It looks as if your fix ought to make it work, though simply replacing whatever prefix the creator used with xlink in both places should also work and work around buggy SVG viewers.

davidchisnall avatar Sep 04 '15 08:09 davidchisnall