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

Diagramsnet does not resolve locally pathed images #1730

Open
mgzob opened this issue Mar 25, 2024 · 1 comment
Open

Diagramsnet does not resolve locally pathed images #1730

mgzob opened this issue Mar 25, 2024 · 1 comment
Labels
👶 good first issue Good for newcomers 🐋 docker Related to Docker code 🙃 upstream 👋 help wanted Help wanted!

Comments

@mgzob
Copy link

mgzob commented Mar 25, 2024

Diagrams.net does not appear to handle clipart based images found locally to the diagrams.net docker itself.

image

This only occurs when an object is referenced via a local path: image=img/lib/clip_art/computers/Printer_Commercial_128x128.png

In the lambda icon to the left it is accessed via mxgraph: shape=mxgraph.aws3.lambda_function

The icons are indeed stored in the docker image. They're copied over at this line, and I can validate they are present at: /usr/local/kroki/assets/img/...

They do not appear to be resolving properly however when used in a diagram.

For replication, here is the xml for the above diagram:

<mxGraphModel dx="636" dy="411" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
  <root>
    <mxCell id="0" />
    <mxCell id="1" parent="0" />
    <mxCell id="XUMacOeo--leUqgM2if5-3" value="This one does not" style="image;html=1;image=img/lib/clip_art/computers/Printer_Commercial_128x128.png" vertex="1" parent="1">
      <mxGeometry x="470" y="212" width="80" height="80" as="geometry" />
    </mxCell>
    <mxCell id="XUMacOeo--leUqgM2if5-4" value="This icon works" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.lambda_function;fillColor=#F58534;gradientColor=none;" vertex="1" parent="1">
      <mxGeometry x="350" y="210" width="80" height="82" as="geometry" />
    </mxCell>
  </root>
</mxGraphModel>

This does resolve properly in the diagramsnet web or local application.

@ggrossetie ggrossetie added 🐞 bug Something isn't working 🐋 docker Related to Docker code 👋 help wanted Help wanted! 👶 good first issue Good for newcomers labels Mar 25, 2024
@ggrossetie
Copy link
Member

Diagrams.net will produce an <image> tag:

<image xmlns="http://www.w3.org/2000/svg" x="120.5" y="1.5" width="80" height="80" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://app.diagrams.net/img/lib/clip_art/computers/Printer_Commercial_128x128.png"/>

As you can see, the base URL is the server URL.
In our case, the diagrams.net server is not accessible and we are using a local HTML page to generate the SVG. As a result, the href is:

<image x="120.5" y="1.5" width="80" height="80" xlink:href="file:///path/to/diagrams.net/assets/img/lib/clip_art/computers/Printer_Commercial_128x128.png"/>

I don't want to serve assets from https://kroki.io. The objective has always been to convert text diagrams into self-contained images (i.e., without any connection to kroki.io).

I don't know if diagrams.net supports embedding png/jpeg images into SVG (using data URIs)? If not, you should probably create a feature request. If it does, then we could configure the export to use that mode.

@ggrossetie ggrossetie added 🐞 bug Something isn't working 🙃 upstream and removed 🐞 bug Something isn't working labels Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👶 good first issue Good for newcomers 🐋 docker Related to Docker code 🙃 upstream 👋 help wanted Help wanted!
Projects
None yet
Development

No branches or pull requests

2 participants