【问题标题】:How to render inside image tag in svg如何在svg中渲染内部图像标签
【发布时间】:2014-12-27 08:45:00
【问题描述】:

在这里,我正在努力生成带有图像标签的 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 文件预览时如何渲染图片?有什么错误吗?

【问题讨论】:

  • 你的javascript在哪里?请将其添加到问题中。
  • @RobertLongson..上面的 svg 代码是从 svg 文件中获取的。当我在 svg 文件中查看时,它存储在 svg 文件中,图像未正确显示。它只会产生空图像!
  • 为什么你的标题提到了javascript,那么你为什么使用javascript和jquery标签呢?

标签: javascript html image svg tags


【解决方案1】:

Google 图片在您显示的区域中是白色的。让它变大让它显示给我。

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

【讨论】:

    猜你喜欢
    • 2021-06-04
    • 1970-01-01
    • 2019-09-21
    • 1970-01-01
    • 2020-03-23
    • 2018-01-29
    • 2021-12-25
    • 2020-11-23
    • 2014-07-04
    相关资源
    最近更新 更多