Skip to main content

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 a Blob (or File); returns SdkResult with an array of { id, objectName, mimeType }. Use objectName as src when adding the image to the canvas.
  • image.uploadTemp({ blob }) — upload a Blob for a temporary asset. Returns SdkResult with an array of { objectId, mimeType }. See the Upload API guide for when to use this versus upload.

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; check isOk and use result before accessing values.
  • Use kittl.design.image.addImage to place the uploaded image on the canvas.