Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html label cannot render the online image #125

Closed
yuanqingfei opened this issue Apr 19, 2018 · 3 comments
Closed

html label cannot render the online image #125

yuanqingfei opened this issue Apr 19, 2018 · 3 comments

Comments

@yuanqingfei
Copy link

yuanqingfei commented Apr 19, 2018

I tried to render

digraph {
    //splines = ortho;
    //rankdir="LR";
    node [shape = box, color=blue];
    edge [dir = none];

I0000 [label=<<table border="0" cellborder="0"><tr><td><img src="http://yuanqingfei.me/images/sparrow2.jpeg"/></td></tr><tr><td><br/><br/>1122</td></tr></table>>]
}

in http://viz-js.com/ . It doesn't work unless I remove the 'img' element. But in offline graphviz, it works. Anything I missing? or this is a bug?

@mdaines
Copy link
Owner

mdaines commented Apr 19, 2018

While you can use the image attribute with nodes in Viz.js (even with HTTP URLs), viz-js.com doesn't support this, since it currently has no way of loading images to determine their dimensions. <img> tags should work, but I haven't tested them.

When using images with Viz.js you'll need to specify the dimensions of the image:

Viz("digraph { ... }", {
  images: [
    { href: "http://example.com/test.png", width: "400px", height: "300px" }
  ]
});

@yuanqingfei
Copy link
Author

yuanqingfei commented Apr 19, 2018

I just tried. It still doesn't work in http://viz-js.com even I add dimensions to my img element. I really hope that it can work properly with

digraph {
    node [shape = box, color=blue];
    edge [dir = none];

I0000 [label=<<table border="0" cellborder="0"><tr><td><img src="http://yuanqingfei.me/images/sparrow2.jpeg" width="50" height="60"/></td></tr><tr><td><br/>袁<br/>1122</td></tr></table>>]
}

@mdaines
Copy link
Owner

mdaines commented Apr 19, 2018

Sorry, viz-js.com doesn't support that. And I believe Graphviz doesn't support width and height attributes on <img> elements, but I could be wrong.

Images are only supported using the images option when using Viz.js as a library.

It would be nice to be able to use images in the web UI, so I've added an issue for that: #126

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants