image(url) or use in an imageFill. The SDK uploads the bytes to Ablo’s hosted storage on your behalf — your API key is the only credential required. The returned URL is a stable CDN edge URL that remains valid across subsequent renders.
ablo.images.upload(params) → UploadedImage
Uploads image bytes to Ablo’s CDN and returns the hosted URL.
The raw image bytes. Accepts either a
Uint8Array (the type you get from fs.readFileSync in Node.js) or an ArrayBuffer.The MIME type of the image. Must be one of the allowed types:
Passing an unlisted MIME type throws a validation error before any network request is made.
| Value | Format |
|---|---|
'image/jpeg' | JPEG |
'image/png' | PNG |
'image/gif' | GIF |
'image/webp' | WebP |
'image/svg+xml' | SVG |
'image/avif' | AVIF |
Optional cosmetic file name used to form the S3 key. Does not affect the returned URL. Useful for debugging storage keys.
Optional deck id that scopes the storage key. Images uploaded with a
deckId are namespaced under that deck in storage. Omitting it still works — the file is stored under a random id.UploadedImage
The CDN URL for the uploaded image. Pass this to
image(url), imageFill(url), or use it directly in an { type: 'image', url, at } layer object.The S3 key where the file is stored. Informational — you don’t need this for slide authoring.
Examples
Upload a local file with Node.js
Read a file from disk usingfs.readFileSync, then upload it and use the CDN URL as an image layer.
Upload and use with the image() builder
When you’re filling a layout placeholder or using the functional builder style, pass the URL to image().
Upload from a browser File input
In a browser context, read the file as an ArrayBuffer and upload it.