Technical notes
SVG files are disabled by default in Joomla, you need to enable it. Note, that SVG files could be potentially dangerous, as it can contain some injected scripts. So be careful, to whom you enable this option.
How are images converted?
The image gets converted in onContentPrepare event, so this plugin works in every content using this event.
By default, Articles works withs this event, also for example module Custom content, when it is enabled in its configuration.
If any img tag pointing local SVG file is detected in such content, the SVG file is loaded and injected directly
to HTML with following rules
- if
widthorheightis specified on the image tag, it will be used instead of those specified in SVG file - any XML and DOCTYPE headers are removed from SVG file, also namespaces, IDs and SVG enable-background attribute
- svg element is extended by class containing
svg-extended by filename of original SVG (so if you use my-super-image.svg) the injected SVG element will get classsvg-my-super-image - no other modifications are performed, so the rest of the SVG file will get injected to yourt HTML code
Why to do this?
If you don't know why to do this, it's simple, just don't do it. Injecting SVGs directly to your HTML could improve your site performance, gives you option for styling those SVGs by CSS, or even animate it by CSS and/or JavaScript. On the other hand, if you don't know what are you doing, it could broke your site or even compromise its security.