ContentImageByKey
→ stringReturns an HTML img element pointing at a Content Builder image identified by external key. Optionally supply a fallback key if the primary asset is missing.
Available in:
Email
CloudPage
Automation
Triggered Send
Syntax
Platform.Function.ContentImageByKey(key[, fallbackKey])
1–2 arguments
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key |
string | Yes | External key of the image in Content Builder |
fallbackKey |
string | No | External key of a replacement image when the primary cannot be resolved |
Return value
A string containing an img tag (including typical attributes such as src, alt, and title as provided by the platform).
Examples
var hero = Platform.Function.ContentImageByKey("hero-2026-campaign");
Write(hero);
var thumb = Platform.Function.ContentImageByKey("product-thumb", "product-thumb-default");
Write(thumb);