This function returns an HTML img tag with the specified Content Builder image. It also sets the title, alt, border and thid attributes on the img tag. The title and alt values are set to the name of the image as defined in Content Builder. The border is set to 0 in all circumstances. The thid is a proprietary Marketing Cloud attribute that contains the ID of the specified image in Content Builder.

NOTE: The ID for the image can be found in the Properties menu, accessible from the drop-down menu on the right-hand side of the Content Builder asset listing page.

NOTE: This function will only return Content Builder assets that are images. It will not return an Image Block from Content Builder.



Ordinal Type Required Description
1 String True ID value of the image to return
2 String False ID value of the image to return if the image for the specified ID is not found

Example 1


var @imageID, @imageTag
set @imageID = "5940" /* limedash-logo-green */

set @imageTag = ContentImageByID(@imageID)

<a href="">%%=v(@imageTag)=%%</a>


<a href=""><img title="limedash-logo-green" alt="limedash-logo-green" src="" border="0" thid="5940"></a>

Example 2

This example illustrates the output when the specified ID does not exist and the fallback image is returned:


var @imageID, @imageIDFallBack, @imageTag
set @imageID = "5999" /* does not exist */
set @imageIDFallBack = "5941" /* limedash-logo-gray */

set @imageTag = ContentImageByID(@imageID, @imageIDFallBack)

<a href="">%%=v(@imageTag)=%%</a>


<a href=""><img title="limedash-logo-gray" alt="limedash-logo-gray" src="" border=0 thid="5941"></a>