Set Image Data
Table of Contents
Overview
This JS API task allows you to embed an image (URL) to an HTML <image> tag. The image can either be a public URL or be retrieved from the value of a Creator field.
Request Details
Syntax
ZOHO.CREATOR.UTIL.setImageData(image_tag, source_url, callback);
The syntax includes:
Name | Type | Description |
image_tag | HTML element | The HTML element where the image needs to be displayed. |
source_url | string | The image's source URL. If the image needs to be retrieved from a Creator field, use the download URL that saves the image from a record. |
callback (Optional) | function | Code to perform further executions with the response. |
Possible Errors
Refer to this page for the complete list of error codes and messages.
Sample Input
Copiedvar imageTag = document.getElementById("image");
var imageFromGetRecordsAPI = "api/v2/zylker/Contacts/view/All_Contacts/66359000000015039/Upload/download"
ZOHO.CREATOR.UTIL.setImageData(imageTag,imageFromGetRecordsAPI);