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
Parameter | Data Type | Description |
Mandatory Parameters | ||
src | String | Specify the url of the image that needs to be inserted. |
height | Integer | Specify the height of the image to be inserted. |
width | Integer | Specify the width of the image to be inserted. |
Sample data with URL
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 data with Bytes
Copiedlet data = {
"src": "data:image/png;base64,iVBORCvtxNCUL1yziNAoCgCQlBRKmkcBAikKtCTIei//30mjBy5W/jgg/eTMS20UP/wta9tGIYMWSMsvPAiyS1nt9/+y+Tn++//4/Dd726T6thrbbzIIejJJx8Phx66d0JxzjkTwsorf7xWlkweJwRlsiw6RYBADwoIQXAI3nwf8JWhgDesKIciwAY95dznzHvMBpPnGChCCjB16Op4kAZa/TtJo0hdCEHMgjgLcgxnHUaPNJgsQgkweffqeCAEux0jEMNIJhwAhiOkQVwHuE4rryNFuEwUIQSaOOn1OjAD3/yRmKOkIIYg5kBABDkwlZCDpRuIFCEGJH2I6mFQBLr1I6sjSL84EMQfiLsB9QnEfQdpvggAhyIRRpo+JEuDLNVHDSWeyCBCCmBZJEeBgVVJGkn4kUYAQlMRRpU+JFeDyt8CCCAQIgChKAQ8akaAQQQQAABBBBAAAEEghcgBAVvTo0IIIAAAggggAACCCAQosD/B7TIOHo28xkGAAAAAElFTkSuQmCC",
"height": 500,
"width": 416.67
};
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
}
]
}
}
}
}