Jump to content

Topic on Project:Support desk

svg transclusion in templates

4
Aloist (talkcontribs)

We have a template which places .gif images like this

https://www.astro.com/im/sym/s_su.18.gif

In the html page rendering, it appears as

<img src="https://www.astro.com/im/sym/s_su.18.gif" alt="s_su.18.gif">

I would like to replace the .gif image with a .svg image like this

https://www.astro.com/im/sym/s_su.18.svg

but that is rendered into

<a class="external free" href="https://www.astro.com/im/sym/s_su.18.svg">https://www.astro.com/im/sym/s_su.18.svg</a>


How can I have it rendered the same way as a gif image?

TheDJ (talkcontribs)

It's because core doesn't know svg as an image format for external images. It is not listed in EXT_IMAGE_REGEX of the Parser, only: gif,png,jpg,jpeg. This regex probably could use an update, please file a ticket in Phabricator to ask for this functionality.

(obligatory note about potential dangers of allowing your editors to include images from the internet)

Aloist (talkcontribs)

Thank you so much. I patched EXT_IMAGE_REGEX in ./parser/Parser.php

I do not know how to file a ticket.

Our wiki is not open to random editors, only a small trusted group can edit.

Pppery (talkcontribs)
Reply to "svg transclusion in templates"