我有使用Raphael.js以编程方式生成的SVG文件。Raphael输出使用PHP写入实际文件。SVG包含嵌入为Base64编码数据的图像。这些文件如下所示:
<svg height="644" version="1.1" width="740" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="overflow: hidden; position: relative; top: -0.583008px;" viewBox="0 0 740 644" preserveAspectRatio="xMidYMid meet">
<image x="185" y="161" width="370" height="370" preserveAspectRatio="none" xlink:href="data: image/png;base64,iVBORw [-- lots of Base64-Data --] ==" transform="matrix(1.3696,-0.3064,0.3064,1.3696,-391.7711,-44.4982)" style="" stroke-width="0.7125311771299471"></image>
<desc>Created with Raphaël 2.2.0</desc>
<defs></defs>
</svg>
这是一个示例文件:http : //www.mybinaryromance.com/files/0.218636001483456524.svg
图像可以在浏览器中正确显示(在Ubuntu上经过Firefox和Chromium测试),但是在其他应用程序(Ubuntu图像查看器,GIMP,TCPDF ...)中,SVG显示为空。为什么会这样呢?
请尝试在之后删除空格data:
。URI语法规范特别禁止在URI中使用空格。请参阅https://tools.ietf.org/html/rfc2396的2.4.3节
可能是浏览器比较宽松,但其他程序却没有。
如果这没有任何改变,则可能是那些程序不支持SVG中<image>
的Data URI 。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句