|balise_img_svg

The balise_img_svg filter allows to insert a <svg> tag or an <img> tag depending on whether its argument is an SVG file or another image format.

  • New in : SPIP 4.2

Indeed:

  • the balise_img filter inserts an <img> tag regardless of the type of image received as an argument, including when it is an SVG file
  • the balise_svg filter always inserts an <svg> tag.

The balise_img_svg filter is therefore useful when applied to an image whose format is unknown in advance and when you want SVG images to be inserted with an <svg> tag.

This filter is applied to the relative URL of an image file or an already formed image tag. It accepts the following optional parameters:

  • alt: alternative text (or a null value to explicitly not have an alt tag on the image instead of an empty alt)
  • class: null by default
  • size: allows you to specify the size of the rendering (see syntax details: |balise_img)

Usage examples:

[(#LOGO_ARTICLE|balise_img_svg{'here application on an img tag', 'spip_logo'})]
[(#FICHIER|balise_img_svg{'here application on a file', 'spip_doc'})]
[(#CHEMIN{#GET{animage}}|balise_img_svg)]

Author jack Published :

Translations : English, français, Português