英文:
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".
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论