dev-master
9999999-dev https://github.com/Plemi/Twig-extensions
MIT
The Requires
by David Guyon
by Xavier Hermans
base64 strpad
Wallogit.com
2017 © Pedro Peláez
Basic Twig function to allow base64 images encoding following latest RFC., (*1)
First of all, add this to your composer.json., (*2)
{
"require": {
"plemi/twig-extensions": "dev-master"
}
}
<service id="plemi.twig.base64_extension" class="Plemi\Twig\Extensions\Base64Extension" public="false">
<tag name="twig.extension" />
</service>
<?php // After registering Twig Silex Provider $app['twig']->addExtension(new \Plemi\Twig\Extensions\Base64Extension());
Then in your twig templates, just call the function with the file path as an argument., (*3)
{{ image64('/images/logo.jpg') }}
MIT
base64 strpad