Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSS

twig data uri

{{ image_data|data_uri }}

{{ source('path_to_image')|data_uri }}

{# force the mime type, disable the guessing of the mime type #}
{{ image_data|data_uri(mime="image/svg") }}

{# also works with plain text #}
{{ '<b>foobar</b>'|data_uri(mime="text/html") }}

{# add some extra parameters #}
{{ '<b>foobar</b>'|data_uri(mime="text/html", parameters={charset: "ascii"}) }}
Source by twig.symfony.com #
 
PREVIOUS NEXT
Tagged: #twig #data #uri
ADD COMMENT
Topic
Name
6+7 =