Image Upload API
kittl.upload lets you upload image files from your app. In the app sandbox, all calls are async.
API
image.upload({ blob })- upload aBlob(orFile); returnsSdkResultwith an array of{ id, objectName, mimeType }. UseobjectNameassrcwhen adding the image to the canvas.image.uploadTemp({ blob })— upload aBlobfor a temporary asset. ReturnsSdkResultwith an array of{ objectId, mimeType }. See the Upload API guide for when to use this versusupload.
Example: upload and add to canvas
const uploadResult = await kittl.upload.image.upload({ blob });
if (uploadResult.isOk) {
const { objectName } = uploadResult.result[0];
await kittl.design.image.addImage({
src: objectName,
size: { width: 200, height: 200, applyViewportScale: false },
position: { relative: { to: 'viewport', location: 'center' } },
});
}
Notes
- All upload methods return
SdkResult; checkisOkand useresultbefore accessing values. - Use
kittl.design.image.addImageto place the uploaded image on the canvas.