Image Syntax
To insert images in your template, use an image tag. Image tag syntax is the same as a simple text tag:
{{ MyImage }}
What makes it an image is the JSON data, that follows a specific structure:
{
"MyImage": {
"_type": "image",
"source": "base64 encoded image data",
"format": "image/jpeg",
"width": 800,
"height": 600,
"altText": "A beautiful sunset", // optional
"transparencyPercent": 0 // optional
}
}
The altText
and transparencyPercent
fields are optional. The transparencyPercent
value ranges from 0 to 100, where 0 means fully opaque and 100 means fully transparent.
Note: Image files must be less than 4MB in size and supported formats include JPEG, PNG, GIF, and BMP.
Simple Example
{
"MyImage": {
"_type": "image",
"source": "base64 encoded image data",
"format": "image/jpeg",
"width": 800,
"height": 600
}
}
Alt Text and Transparency
{
"MyImage": {
"_type": "image",
"source": "base64 encoded image data",
"format": "image/jpeg",
"width": 800,
"height": 600,
"altText": "A beautiful sunset",
"transparencyPercent": 50
}
}