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
Use three braces, {{{ }}}, so the image data is inserted exactly as is.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
file_reference | object | Yes | A 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.
Related Topics
- Generate PDF: turn HTML with embedded images into a PDF
- File Uploads in Forms: collect files from form visitors