Dynamic content

luastra/content

Selects, transfers, and displays bounded images through opaque handles without exposing storage-provider URLs, bucket paths, local paths, filenames, or raw bytes to Luau.

Request a browser image, render the returned Content.Image with UI.Image, create an intent in a declared backend function, stream it, then commit before storing the opaque object ID.

Treat content and upload handles as ephemeral private state: release previews, refresh display grants after an error, and never persist or log handles.

Complete example

local Content = require("luastra/content")
local UI = require("luastra/ui")

local cover = Content.image(result.source, {
    mediaType = result.mediaType,
    bytes = result.bytes,
    width = result.width,
    height = result.height,
})

return UI.Image {
    id = "article/cover",
    source = cover,
    label = "Article cover",
    onError = "cover.refresh",
}

Detail pages

Content.ImageMetadataContent.ImageContent.PickOptionsContent.PickSelectedContent.PickCancelledContent.PickResultContent.UploadProgressContent.UploadResultContent.imageContent.uriContent.pickImageContent.decodePickContent.releaseContent.uploadContent.cancelUploadContent.decodeUploadContent.decodeProgress