Media assets
There are some helpful functions to access the stored assets within Hublify MAM.
- "Media Assets" are any kind of files stored in the Hublify's storage (HDD).
- Hublify stores additionally for each "Media Asset" extra data in the Media Asset Manager Database.
- Each Media Asset is identified in the MAM by its unique asset-label.
Media Asset Queries
Search the Media Asset Manager Database for asset files and their corresponding asset-labels.
Fields
Selectable fields available are
- name ...
- ...
Assets in templates
There are several ways of how to integrate assets (files) into your final rendered html-templates.
Here are some examples described.
hublify.image(...)
With this function you can very easily let Hublify scale / transform you images and render complete <picture>-tags!
{{ hublify.image('myMAMLabel').render_picture('default') }}
assetResourceUrl(...)
To get the site-public url of a media asset, for example of an image, it would look like this:
<img src="{{ hublify.assetResourceUrl('myFavoritePic') }}">
asset64(...)
Gets an asset as a ready-to-use html-tag ("<img...", "<svg...", ...) with its content base64-encoded, inline.
/** * @param string $assetLabel The asset-label * * @param array $params * * [attributes] - // all other whatever-you-want-to-set attributes... * [<var>] - "<your values>" * * [resize_width] int (optional, default: none) Image resize width. * [resize_height] int (optional, default: none) Image resize height. * * @return string Returns a ready-to-use html-tag ("<img...", "<svg...", ...) with its * content base64-encoded, inline. In case of an error NULL is returned. */
asset64(string $assetLabel, array $params = null): ?string
For example to output (inline render) an asset "myLogo" use something like this:
<a href="..."> {{ hublify.asset64('myLogo') }} </a>