2017-05-02 23 views
0

所以我用这个追加的节点的图像和它的伟大工程:D3追加图像,但是从本地目录

```this.node.append("svg:image") 
     .attr("class", "lock") 
     .attr("dx", 12) 
     .attr("dy", ".35em") 
     .attr('x',5)
   
     .attr('y',-15)
   
     .attr('width', 10) 
     .attr('height', 10) 
     .attr("xlink:href", "https://example.com/png");``` 

的问题是,我想使用本地IMG作为一个src的img我无法得到它加载。使用Word新闻

+0

相关:http://stackoverflow.com/questions/12456007/syntax-for-svg-图像元素的使用,一个本地资源。 – altocumulus

回答

-1

的问题是由于球队,所以我不得不给它一个不同的路径:

this.node.append("image") 
    //... 
    .attr("xlink:href", "http://localhost/wp-content/uploads/2017/lock.png");