[SOLVED] Render SVG as svg-code not as img-tag

Hi everyone,

I’d like to do the following:

  1. Have editors upload an SVG as an image so that they can see the representation in the inspector
  2. Output the uploaded SVG in the markup as <svg …/> not as

The first part is easy as it is only a matter of putting it into the configuration .yaml
The second part is tricky. Is it possible in Fusion? I would have to retrieve the actual binary information for that particular file and then probably manipulate it, e.g. adding in classnames and colors.

Regards, Jan

Should be easily possible with a custom Eel helper that is a wrapper around stream_get_contents(). Fusion would look like this, assuming you create a StreamHelper with a method called getContents:

prototype(Your.Custom:SVGImage) {
    svg = ${Stream.getContents(q(node).property('asset').resource.stream)}

Thanks, @beheist. I’ll discuss that with @sebastianheuer!