如何在svg中渲染内部图像标记

时间:2014-12-27 08:45:01

标签: javascript html image svg tags

这里我努力用图像标签生成SVG文件。在图像标签中,XLINK:HREF将正确显示图像路径,但在预览图像时不会显示图像。

这是我的样本SVG代码:

<svg width="525" height="300" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">

 <g display="" id="front">
  <title>Front 1</title>
  <image xlink:href="/uploads/image_gallery/portrait/879795_print_plus.jpg" src="/uploads/image_gallery/portrait/879795_print_plus.jpg" id="svg_1" height="400" width="400" y="0" x="86"></image>
  <image x="0" y="0" width="5" height="5" xlink:href="http://www.google.co.uk/images/srpr/logo3w.png"></image>
  <rect stroke-width="3" stroke="#000000" fill="#FFF" id="svg_2" height="202" width="202" y="67" x="35"></rect>
  <ellipse ry="77" rx="122" stroke-width="3" stroke="#000000" fill="#FFF" id="svg_3" cy="82" cx="275"></ellipse>
  <line fill="none" stroke-width="3" stroke="#000000" id="svg_4" y2="197" x2="109" y1="75" x1="363"></line>
 </g>
</svg>

加密图像SRC也无法正确渲染如何在svg文件中预览时渲染图像?有什么错误吗?

1 个答案:

答案 0 :(得分:0)

您正在显示的区域中的Google图片为白色。把它做大让我显示出来。

<image x="0" y="0" width="35" height="35" xlink:href="http://www.google.co.uk/images/srpr/logo3w.png"></image>
相关问题