SVG in <img> do not render

0 votes
asked Dec 6, 2020 in Bug by Marius

Simple example:

@startuml
rectangle "<img:https://upload.wikimedia.org/wikipedia/commons/8/8c/SVG_logo_h.svg>"
@enduml

This raises an IllegalStateException: cannot find height

It also happens with other SVG files, e.g. https://blog.hubspot.com/hubfs/svg-orange-circle.svg

Best regards!

2 Answers

0 votes
answered Jan 26, 2021 by Martin

The SVG file may be missing the height and width in the opening <svg> tag:

It reads <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40">, so maybe should read <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="128" height="128"> or whatever you want the default size to be. Just a guess, though, as I can't get SVGs to render at all myself (which is how I found this bug report).

0 votes
answered Feb 2, 2021 by plantuml (276,340 points)
This should be fixed in last release V1.2021.1

We are now also using viewBox when available.

Tell us if you find other issues!
commented Feb 4, 2021 by Marius
Thank you. The posted snippet works. But if I try it with the second URL from my original post, it fails with this error:

(Cannot decode SVG: https://blog.hubspot.com/hubfs/svg-orange-circle.svg)
...