如何在Memgraph Lab中将SVG文件用作节点背景?

huangapple go评论46阅读模式
英文:

How can I use an SVG file as a node background in Memgraph Lab?

问题

我在文档中找到了,我可以使用GSS NodeStyle指令属性将图像用作节点的背景。使用图像的代码很容易理解 image-url: "https://download.memgraph.com/asset/images/memgraph-logo.png",但我想要使用SVG文件作为背景。我可以这样做吗?

英文:

I've found in the docs that I can use image as a background for the nodes using GSS NodeStyle directive properties. Code for using images is simple to understand image-url: "https://download.memgraph.com/asset/images/memgraph-logo.png" but I'd like to use SVG file as background. Can I do this?

答案1

得分: 0

我已经对这个主题进行了一些研究。我在Orb GitHub存储库中找到了一个问题,这可能会有所帮助。似乎最简单的方法是将图像转换为DataURI,然后在GSS中使用它。
有在线工具可以从图像中获取DataURI,它是包含完整图像信息的文本。

另一种方法在Memgraph文档中描述,它涉及将SVG文件转换为PNG。我认为这种方法的问题在于您需要连接到某个服务,将图像上传到该服务。

我希望将所有资源放在一个地方,所以我尝试了将PNG文件复制到Memgraph平台的Docker镜像中的想法。如果您将它们复制到/lab/dist-frontend/assets/img,然后在GSS代码中引用它们,可以通过image-url: "http://localhost:3000/assets/img/image-nampe.png"来引用图像文件。

英文:

I've done some research on this topic. I've found an issue in Orb GitHub repository that might be helpful. It seems that the easiest way is to convert image to DataURI and then use that in the GSS.
There are tools online to give you DataURI from an image, it is a text which contains full image info.

Other method is described in Memgraph documentation and it comes down to converting SVG file to PNG. The issue that I see with this approach is that you need connection to some service where you've uploaded the image.

I want to have all my resources in one place so I've played around with idea of copying PNG files into Docker image for Memgraph Platform. You can reference the image files if you copy them to /lab/dist-frontend/assets/img and then reference them in GSS code with image-url: "http://localhost:3000/assets/img/image-nampe.png".

huangapple
  • 本文由 发表于 2023年6月5日 17:32:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/76405102.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定