Javascript: ImageCollection.getItem Method
Description
Gets the image selected by the user or the image with the specified identifier.
Syntax
<void> ImageCollection.getItem(<RequestImageCallback> callback, [<ErrorCallback> errorCallback], [<number> id])Parameters
| Parameter | Description |
|---|---|
| callback | Receives the requested image or null if there is no image at the current input position / with the specified identifier. |
| errorCallback | Optional. Is called when the operation failed with an error. |
| id | Optional. The image's identifier. |
Examples
The following example demonstrates ImageCollection.getItem in a practical document-editing workflow. It gets the image selected by the user or the image with the specified identifier.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.images.getItem(
function(image) {
if (!image) {
console.warn("No image was returned.");
return;
}
console.log("get item result:", image);
},
onTxError,
25
);