缺少 xml 标记 SVG 文件(使用 Graphviz dot.exe)

发布于 2024-10-10 15:44:13 字数 620 浏览 0 评论 0原文

我的配置是:
- Windows Vista
- XAMPP 1.7.1
- 媒体维基 + 语义 MW
- 使用 Graphviz 创建 SVG 的扩展
- Graphviz 2.26.3(安装目录 c:\graphviz.....)

一切正常,但问题是:xml 标签
'图像 xlink:href="some_image.png"....'
使用 Media Wiki php 页面创建的 SVG 文件中缺少。

这是通过以下方式完成的:
$cmdlinesvg = wfEscapeShellArg($cmd)。' -T svg '.wfEscapeShellArg($src)'。 -o '.wfEscapeShellArg($svg);
$WshShell = new COM("WScript.Shell");
$WshShell->Exec($cmdlinesvg);

我创建了一个执行相同命令行的批处理文件:

c:\graphviz2.26.3\bin\dot.exe -T svg filename.dot -o filename.svg

如果我手动运行它,它可以工作,并且 xml 标记出现。

有人知道是什么问题吗?提前致谢。

My config is:
- Windows Vista
- XAMPP 1.7.1
- Media Wiki + Semantic MW
- an extension that uses Graphviz to create a SVG
- Graphviz 2.26.3 (install dir c:\graphviz.....)

Everything works fine but the problem is: the xml tag
'image xlink:href="some_image.png"....'
is missing from the SVG file created using a Media Wiki php page.

This is done by:
$cmdlinesvg = wfEscapeShellArg($cmd).' -T svg '.wfEscapeShellArg($src).' -o '.wfEscapeShellArg($svg);
$WshShell = new COM("WScript.Shell");
$WshShell->Exec($cmdlinesvg);

I've created a batch file that executes the same command line:

c:\graphviz2.26.3\bin\dot.exe -T svg filename.dot -o filename.svg

and if I run it manually it works, and the xml tag appears.

Anyone knows what is the problem? thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小…楫夜泊 2024-10-17 15:44:13

已解决

该问题与 .DOT 文件中的图像路径有关。

如果手动运行命令行,图像路径不需要是完整路径。
您只能有: shapefile="some_image.png"

如果您在 php 代码中运行该命令,则图像路径必须是完整路径。
所以你必须有: shapefile="C:\xampp......\some_image.png"

另一个问题出现:生成的 .SVG 文件不显示图像。

如果右键单击并使用浏览器(即Firefox)打开.SVG 文件,则图像正常。
但是,再一次,通过 php 页面,图像会丢失。
解决方案:编辑 .SVG 文件(这是 XML)以更改路径。
在原始 .SVG 文件上,我们有:
在修改后的 .SVG 文件上,我们必须有:

PS:我正在做我的硕士论文,所以这是针对一个特定问题的,但我仍然希望它对某人有所帮助。

SOLVED

The problem is related to the image path that is in the .DOT file.

If you run the command line manually, the image path doesn't need to be a full path.
You can have only: shapefile="some_image.png"

If you run the command inside php code, the image path HAS to be a full path.
So you must have: shapefile="C:\xampp......\some_image.png"

Another problem arises: the resulting .SVG file doesn't show the images.

If you right-click and open the .SVG file with the browser (ie Firefox), the images are ok.
But, again, through a php page, the images are lost.
Solution: edit the .SVG file (this is XML) to change the paths.
On the original .SVG file we have:
On the modified .SVG file we must have:

PS: I'm doing my master thesis, so this is for a particular problem, but still I hope it helps someone.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文