Webdot - Images - SVGZ

I believe I found a bug in webdot, I was about to submit it but in light of my last "issue" (my setup was at fault) I figured I would present it here first:

Using graph.dot file:
digraph G {
imagepath="/var/www/html/some_directory/webdot/";
node [URL="\N.html",image="server.gif"]
a -> b -> c
a -> c -> a
}

The graph and images draw perfectly with:

But if I try to get the equivalent SVGZ:

The graph draws fine but the images cannot be displayed.
I believe this is because the link to the image becomes /cgi-bin/webdot/webdot/server.gif
Which returns:
WebDot Error:

Unrecognized MIME type for graph: image/gif
and unrecognized file extension: gif

Which makes sense since webdot is not expecting a gif... Or am I missing something again?

Thanks,
Flo

Re: Webdot - Images - SVGZ

Do you have the gd plugin installed?   (graphviz-gd, or graphviz-plugin-gd in recent snapshots.)

The image has to be readable both by the server, for sizing and layout,  and then by the ultimate SVG client for rendering.    I think this should work if the image is in the same directory as the graph.  The image= might need the full URL.

Can you tell where the MIME error is coming from?  client or server?

 

 

The MIME error is coming from

The MIME error is coming from WebDot, as seen in Flo's original posting:

WebDot Error:

Unrecognized MIME type for graph: image/gif
and unrecognized file extension: gif

Here is what I believe is happening. The browser asks the server for, say,

/cgi-bin/webdot/webdot/f.dot.dot.svg

This gets processed by webdot which returns the svg which contains something like

<image xlink:href="server.gif" width="259px" height="32px" preserveAspectRatio="xMinYMin meet" x="8.5" y="-323"/>

The browser then requests this image with the same path it used for the original image, that is,

/cgi-bin/webdot/webdot/server.gif

This is what is seen in the access log. The server then does what is did previously, i.e., it calls webdot but with the argument webdot/server.gif, which causes webdot to reject the suffix and return the error message as text. I assume the svg renderer in the browser recognizes the text is not an image and ignores it.

Is there a simple fix?

Is there a simple fix to this? Do I need to modify the CGI or is it graphviz related?

I was hoping John would

I was hoping John would address this, but I believe he is away on vacation. At this time, I'm not sure how to handle this. The issue is that the user's browser requests server content at

  /cgi-bin/webdot/webdot/f.dot.dot.svg

The returned content contains an image filename, say, img.gif. The browser asks for this relative to the location of the original request, i.e.,

  /cgi-bin/webdot/webdot/img.gif

This causes the server to re-invoke webdot, which rightly responds that it doesn't handle gif files.

Is there some way to tell the browser to not use the /cgi-bin/webdot/ path when looking for the image? If so, can this be incorporated in the returned svg content or its HTML wrapper? Another approach might be to change webdot to accept image requests and return the requested image. This probably requires webdot to figure out where the image is, which involves using full pathnames for images in svg, or introducing state in webdot (ugh), or giving webdot something akin to the imagepath attribute in graphviz.

If you can make some assumptions, the solution could be easy. For example, if you assume that the image name will be relative to the server's root, then webdot wants to find, say, webdot/img.gif as though it requested it from the server. One would like to think such a service already exists. Or, at worst, you probably know where the server's root directory is, which could be built into your version of webdot. I guess this is roughly equivalent to my suggestion above of building in an imagepath in webdot.

 

No luck

Hi,

I have all the stable rpms installed on my server:
[[email protected] webdot]# yum list graphiz*
Installed Packages
graphviz.x86_64                                             2.34.0-1.el6                                       @/graphviz-2.34.0-1.el6.x86_64
graphviz-devel.x86_64                                       2.34.0-1.el6                                       @/graphviz-devel-2.34.0-1.el6.x86_64
graphviz-doc.x86_64                                         2.34.0-1.el6                                       @/graphviz-doc-2.34.0-1.el6.x86_64
graphviz-gd.x86_64                                          2.34.0-1.el6                                       @/graphviz-gd-2.34.0-1.el6.x86_64
graphviz-graphs.x86_64                                      2.34.0-1.el6                                       @/graphviz-graphs-2.34.0-1.el6.x86_64
graphviz-guile.x86_64                                       2.34.0-1.el6                                       @/graphviz-guile-2.34.0-1.el6.x86_64
graphviz-java.x86_64                                        2.34.0-1.el6                                       @/graphviz-java-2.34.0-1.el6.x86_64
graphviz-lua.x86_64                                         2.34.0-1.el6                                       @/graphviz-lua-2.34.0-1.el6.x86_64
graphviz-ocaml.x86_64                                       2.34.0-1.el6                                       @/graphviz-ocaml-2.34.0-1.el6.x86_64
graphviz-perl.x86_64                                        2.34.0-1.el6                                       @/graphviz-perl-2.34.0-1.el6.x86_64
graphviz-php.x86_64                                         2.34.0-1.el6                                       @/graphviz-php-2.34.0-1.el6.x86_64
graphviz-python.x86_64                                      2.34.0-1.el6                                       @/graphviz-python-2.34.0-1.el6.x86_64
graphviz-qt.x86_64                                          2.34.0-1.el6                                       @/graphviz-qt-2.34.0-1.el6.x86_64
graphviz-ruby.x86_64                                        2.34.0-1.el6                                       @/graphviz-ruby-2.34.0-1.el6.x86_64
graphviz-tcl.x86_64                                         2.34.0-1.el6                                       @/graphviz-tcl-2.34.0-1.el6.x86_64
graphviz-x.x86_64                                           2.34.0-1.el6                                       @/graphviz-x-2.34.0-1.el6.x86_64

What can I do to check graphviz-gd is working properly?

The image (gif) and the graph (dot and html) are in the same directory. I checked the permissions (even tried a chmod 777 for good mesure).

On the image URL, I get errors server side if I change the URL:
[Mon Dec 23 15:22:35 2013] [error] [client XX.XX.XX.XX] Warning: "webdot/server.gif" was not found as a file or as a shape library member, referer: http://mydomain/webdot/test.php
[Mon Dec 23 15:23:05 2013] [error] [client XX.XX.XX.XX] Warning: "/webdot/server.gif" was not found as a file or as a shape library member, referer: http://mydomain/webdot/test.php
[Mon Dec 23 15:23:30 2013] [error] [client XX.XX.XX.XX] Warning: "http://mydomain/webdot/server.gif" was not found as a file or as a shape library member, referer: http://mydomain/webdot/test.php

If I browse to http://mydomain/webdot/server.gif, the image displays.

If I don't use imagepath, I also get an error on the server:
[Mon Dec 23 15:22:35 2013] [error] [client XX.XX.XX.XX] Warning: "server.gif" was not found as a file or as a shape library member, referer: http://mydomain/webdot/test.php

For the MIME error, I just use chrome "developper tools", Network and I can see in there that server.gif is expected to come from /cgi-bin/webdot/webdot/. Double clicking on it display the error I mentioned.

Sorry if this is a repost, I cannot see my previous reply. I can send screenshots of the browser dev tools if you email me.

 

Thanks,

Flo

Can't figure it out

Hi,

I have all the stable rpms installed on my server:
[[email protected] webdot]# yum list graphiz*
Installed Packages
graphviz.x86_64                                             2.34.0-1.el6                                       @/graphviz-2.34.0-1.el6.x86_64
graphviz-devel.x86_64                                       2.34.0-1.el6                                       @/graphviz-devel-2.34.0-1.el6.x86_64
graphviz-doc.x86_64                                         2.34.0-1.el6                                       @/graphviz-doc-2.34.0-1.el6.x86_64
graphviz-gd.x86_64                                          2.34.0-1.el6                                       @/graphviz-gd-2.34.0-1.el6.x86_64
graphviz-graphs.x86_64                                      2.34.0-1.el6                                       @/graphviz-graphs-2.34.0-1.el6.x86_64
graphviz-guile.x86_64                                       2.34.0-1.el6                                       @/graphviz-guile-2.34.0-1.el6.x86_64
graphviz-java.x86_64                                        2.34.0-1.el6                                       @/graphviz-java-2.34.0-1.el6.x86_64
graphviz-lua.x86_64                                         2.34.0-1.el6                                       @/graphviz-lua-2.34.0-1.el6.x86_64
graphviz-ocaml.x86_64                                       2.34.0-1.el6                                       @/graphviz-ocaml-2.34.0-1.el6.x86_64
graphviz-perl.x86_64                                        2.34.0-1.el6                                       @/graphviz-perl-2.34.0-1.el6.x86_64
graphviz-php.x86_64                                         2.34.0-1.el6                                       @/graphviz-php-2.34.0-1.el6.x86_64
graphviz-python.x86_64                                      2.34.0-1.el6                                       @/graphviz-python-2.34.0-1.el6.x86_64
graphviz-qt.x86_64                                          2.34.0-1.el6                                       @/graphviz-qt-2.34.0-1.el6.x86_64
graphviz-ruby.x86_64                                        2.34.0-1.el6                                       @/graphviz-ruby-2.34.0-1.el6.x86_64
graphviz-tcl.x86_64                                         2.34.0-1.el6                                       @/graphviz-tcl-2.34.0-1.el6.x86_64
graphviz-x.x86_64                                           2.34.0-1.el6                                       @/graphviz-x-2.34.0-1.el6.x86_64

What can I do to check graphviz-gd is working properly?

The image (gif) and the graph (dot and html) are in the same directory. I checked the permissions (even tried a chmod 777 for good mesure).

On the image URL, I get errors server side if I change the URL:
[Mon Dec 23 15:22:35 2013] [error] [client XX.XX.XX.XX] Warning: "webdot/server.gif" was not found as a file or as a shape library member, referer: 

http://mydomain/webdot/test.php
[Mon Dec 23 15:23:05 2013] [error] [client XX.XX.XX.XX] Warning: "/webdot/server.gif" was not found as a file or as a shape library member, referer: 

http://mydomain/webdot/test.php
[Mon Dec 23 15:23:30 2013] [error] [client XX.XX.XX.XX] Warning: "http://mydomain/webdot/server.gif" was not found as a file or as a shape library 

member, referer: http://mydomain/webdot/test.php

 

If I browse to http://mydomain/webdot/server.gif, the image displays.

If I don't use imagepath, I also get an error on the server:
[Mon Dec 23 15:22:35 2013] [error] [client XX.XX.XX.XX] Warning: "server.gif" was not found as a file or as a shape library member, referer: 

http://mydomain/webdot/test.php

For the MIME error, I just use chrome "developper tools", Network and I can see in there that server.gif is expected to come from /cgi-bin/webdot/webdot/. Double clicking on it display the error I mentioned.

Also, on an unrelated note, I can only use imagepath with one path. If I try to use it with mutiple paths (imagepath="/var/www/html/some_dir/webdot/,/var/cache/webdot/";) it gives me the same error (server side) as if I wasn't using imagepath.

Are you able to reproduce it? Do you have a setup displaying images in SVG I could look at?

Thanks,

Flo

I did spend some time looking

I did spend some time looking at this, and I'm sorry but I didn't see an easy fix.

The root cause of the problem is that the images are needed at two times in the process, but those two times occur in different places (when using svg).

The image  is needed on the webdot server, for the layout calculation, and then it is needed by the svg renderer, on some client browser, at some arbitrary later time and place.

There are side issues, such as the original images might be accessible from the server, but not from the client, for some networking or permissions reason.

I think what I have to do is parse the graph and get all the images on the webdot server, so that the SVG and the images are all in the same place for the final rendering.  Then I have to (potentially) rewrite all the image refs in the SVG to refer to them on the webdot server.

Alternatively, if I could encode the images in some way into the SVG so that the SVG is self contained....

    http://stackoverflow.com/questions/6249664/does-svg-support-embedding-of...

... ah, ok, now its just a SMOP.

 

Looking forward to it :D

Looking forward to it :D

Recent comments