The |embarque_src
filter applied to a <img src="..." />
tag allows you to modify the src attribute to generate and retrieve the image as a base 64 encoded "Data URI Scheme" of the form: <img src="data:[<mediatype>][;base64],<data>" />
.
Example
[(#CHEMIN{images/tdm.png}|balise_img)]
returns
<img src="squelettes/images/tdm.png" width='16' height='16' />
while
[(#CHEMIN{images/tdm.png}|balise_img|embarque_src)]
will return
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAFo9M/3AAAABGdBTUEAANb..." width='16' height='16'>
...so the file will not be loaded from the source but displayed directly from the encoded string.
Size Limit
The purpose of this filter is to embed small images.
If the image passed in is too large (default 4kb), the filter will not be applied and will return the image path.
However, it is possible to force this setting
[(#CHEMIN{img/newsletter_banner.png}|balise_img|embarque_src{9000})]
NB: this filter is provided by the plugin-dist compressor, through the PHP function
filtre_embarque_src.
Caution : the result provided by this filter is not supported by all browsers or e-mail clients.
See also
Tags
Filters