[Webinar] Live demos, interactions, and user Q&A with Zoho Writer product experts. Book your seat

Skip to product menu
Skip to main content

Insert image from extension into document

Purpose

To insert the image from extension into the current writer document.

Syntax

WriterClient.dispatch("insertImage", <image_data_variable>).then(function(response){console.log(response)});

Data Parameters

ParameterData TypeDescription
Mandatory Parameters
srcStringSpecify the url of the image that needs to be inserted.
heightIntegerSpecify the height of the image to be inserted.
widthIntegerSpecify the width of the image to be inserted.

Sample data with HTML

Copiedlet data = {
                     "src": "https://images.pexels.com/photos/18340828/pexels-photo-18340828/free-photo-of-man-in-traditional-north-american-indigenous-clothing.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2",
                     "height": 1800,
                     "width": 1600
                 };
WriterClient.dispatch("insertImage", data).then(function(response){console.log(response)});

Sample Response

Copied{
 "message": "Object Fetched ",
 "data": {
 "content": {
 "data": {
       "result": 1,
       "response": [
            {
                height: 1800,
                id: "88522831",
                src: "https://writer.zoho.com/writer/image.do?imgurl=r-c0hk44e4268dc22474caeacbc065c22385eae-49e39dab4ad14650ba95cc58989560ebef9iax10vfsh&rid=c0hk44e4268dc22474caeacbc065c22385eae",
                width: 1600
            }
          ]
        }
      }
   }
}