image_uri
The image_uri function can be used in any Aurora front-end template to return the URI of an image for a origin based on the parameters provided.
This article describes how to use this function and it's various options.
Overview
This is an Aurora template function to allow embedding of origin images into templates.
In order to avoid having to recode your templates if you move from different image libraries, we've created a function you can use called {image_uri}. If new image libraries are integrated with Aurora these could also be made available through this function and remove the need for template changes.
This function accepts the following image formats: JPG, PNG or GIF
Parameters
Parameter | Example | Mandatory | Explanation |
---|---|---|---|
width | 100 | Y | The width of the image |
height | 100 | Y | The height of the image |
image_id | 1 | N | The ID of the image |
type | resizeandcrop | N | The way that Aurora will choose to resize an image. This is only applicable to Aurora. Please see Image URI Transformation Types for further information, and examples of usage, regarding the available transformation types available. |
origin | Reviews | Y | The origin of the image on which it's ID is based. You have the following options: Reviews (For Products Reviews) User (User Photos) Language (For Languages Images) Attribute (For Product Attribute) |
Example Usage
The below examples assume that the user is visiting the domain: visitdomain.co.uk.
Getting the original image
The original image can be returned - with its original aspect ratio and dimensions - by simply not specifying any image processing parameters.
{image_uri image_id=1 origin="Product"}
If you know the exact image ID
This is an example that can be used to display a language flag, if you know the language id:
If you know the exact image ID
{image_uri image_id=1 width=25 height=25 origin="Language"}
To display a users image
This could be used to display an image of a user:
If you know the origin ID
{image_uri image_id=$users.id width=200 height=200 origin="User"}
Updated over 2 years ago