plemi / twig-extensions
dev-master
2013-07-06 12:10 UTC
Requires
- symfony/http-foundation: >=2.1, <2.4
- twig/twig: ~1.12
This package is not auto-updated.
Last update: 2024-12-25 07:49:22 UTC
README
Base64 encoding for images
Basic Twig function to allow base64 images encoding following latest RFC.
Usage in the real world
First of all, add this to your composer.json.
{ "require": { "plemi/twig-extensions": "dev-master" } }
Symfony2
<service id="plemi.twig.base64_extension" class="Plemi\Twig\Extensions\Base64Extension" public="false"> <tag name="twig.extension" /> </service>
Silex
<?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.
{{ image64('/images/logo.jpg') }}