Gets an asset as a ready-to-use html-tag ("<img...", "<svg...", ...) with its content base64-encoded, inline.
Syntax
asset64(string $assetLabel, array $params = null): ?string
Parameter
- $assetLabel
The MAM-asset label - $params
Optional parameters for rendering
'attributes': { // all other whatever-you-want-to-set attributes...
'<key>': '<value>'
},
'resize_width': <value>, // int (optional, default: none) Image resize width.
'resize_height': <value> // int (optional, default: none) Image resize height.Return
Returns a ready-to-use html-tag ("<img...", "<svg...", ...) with its content base64-encoded, inline.
In case of an error NULL is returned.
Examples
Source (twig)
{% set params = {
'attributes': {
'style': 'width: 100%',
'class': 'example'
},
'resize_width': 768
} %}
{{ hublify.asset64(image.mb_label, params) }}Output (html)
<img style="width: 100%" class="example" src="BASE64_STRING">