Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add image to SVG with Bobril

I am trying to add image to SVG with Bobril, but this code doesn't work:

{
    tag: 'svg',
    children: {
        tag: 'image',
        attrs: {
            'xlink:href': 'https://raw.githubusercontent.com/Bobris/Bobril/master/logo.png',
            x: 0,
            y: 0,
            width: 200,
            height: 200
        }
    }
}

Image tag is added to the page, but no image is shown. When I copy the element in Chrome's DevTools and paste it once again, the image is shown. What am I doing wrong?

like image 415
Margarit Avatar asked Dec 21 '25 11:12

Margarit


1 Answers

Instead of 'xlink:href' use just href.

xlink:href is deprecated since SVG 2

like image 104
Roman Flössler Avatar answered Dec 22 '25 23:12

Roman Flössler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!