[SPIP] PUBLISHED : |embarque_fichier

SPIP

Article validated

The article « |embarque_fichier
(https://www.spip.net/en_article6749.html) » was validated by George.


|embarque_fichier

Saturday 17 September 2022 , by jack

The filter |embarque_fichier allows you to replace a file embedded in a
tag with its equivalent in Data URI Scheme
(https://en.wikipedia.org/wiki/Data_URI_Scheme) encoded in base 64

Table of contents

  • Example
  • See also

The filter |embarque_fichier applied to a path to a file returns the
base 64 encoded « Data URI Scheme » version of that file, which directly
contains the data. Of the form: data:[<mediatype>][;base64],<data>.

Example|Back to the table of contents

<img src="

[


(


#CHEMIN


{images/tdm.png}


)


]

">

will produce the tag
<img src="squelettes/images/tdm.png">

while

<img src="

[


(


#CHEMIN


{images/tdm.png}


|embarque_fichier


)


]

">

will produce the tag
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAFo9M/3AAAABGdBTUEAANb...>

…so the file will not be loaded from the source but displayed directly
from the encoded string.

NB: this filter is provided by the plugin-dist compressor through the
PHP function filtre_embarque_fichier
(https://code.spip.net/autodoc/tree/plugins-dist/compresseur/compresseur_fonctions.php.html#function_filtre_embarque_fichier).

Caution : the result provided by this filter is not supported by all
browsers or e-mail clients.

See also|Back to the table of contents

Tags

Filters

— Sent by SPIP (https://www.spip.net/)


rubon199-7e493.jpg