Skip to main content

artifact_data_uri

Turns a file from your automation, such as a form upload, into text you can place in an HTML src attribute. Use it to show images in the HTML for Generate PDF.

Syntax​

{{{artifact_data_uri file_reference}}}

Use three braces, {{{ }}}, so the image data is inserted exactly as is.

Parameters​

ParameterTypeRequiredDescription
file_referenceobjectYesA file reference from the current automation, such as a form File field or the results of Generate PDF.

Returns​

The helper returns a string in this format:

data:content/type;base64,encoded-file-data

It uses the file's MIME type, such as image/png. If the file has no valid MIME type, it uses application/octet-stream.

Examples​

Embed a form upload​

For a File field named photo:

<img src="{{{artifact_data_uri input.photo}}}" alt="Submitted photo">

Embed an item from a Files field​

<img src="{{{artifact_data_uri input.photos.[0]}}}" alt="First submitted photo">

Embed an action-generated file​

For an earlier action whose results variable is chartImage:

<img src="{{{artifact_data_uri custom.chartImage}}}" alt="Generated chart">

Constraints​

  • The file must come from the current automation.
  • The file cannot exceed 50 MB.
  • Base64 encoding increases the size of the final HTML, so use only the images and files the output needs.