← Dynamic content

Content.Image

luastra/content

Content.Image is an exported, statically checked data contract of luastra/content. Its exact declaration documents the fields or alternatives accepted at the module boundary and is erased after Luau analysis.

Before you use it

Add luastra/content to this module's dependencies in luastra.json, then import it with require("luastra/content"). Declare content.pick for browser selection and content.upload for transfer. Upload requires a server-created intent from an authenticated declared backend function. Application code must never construct a provider URL, file path, data URL, blob URL, bucket path, or upload handle.

How it fits

Content types describe checked ephemeral image references and asynchronous selection/upload results; they are erased after Luau analysis.

When to use it

Use Content.Image when annotating values that cross the public luastra/content boundary or when exporting helpers built on that module. The type documents the exact checked shape and prevents unrelated tables from being substituted accidentally.

Fields or definition

ParameterType / valuesDescription
kind"image"Literal discriminator identifying the exact alternative in this union.
uristringCanonical host-neutral resource URI derived from the admitted asset.
metadataImageMetadataChecked metadata field of Content.Image; its exact admitted type is ImageMetadata.

What happens next

A type-safe dynamic image, selection, transfer, or progress annotation.

Failures and fixes

Cancellation, malformed or expired handles, unsupported media types, excessive bytes or dimensions, offline transfer, authorization denial, and decode failure remain explicit branches. Release previews, request fresh display grants after UI.Image.onError, and never persist or log upload/content handles.

Availability

Private source foundation after 0.5.0-alpha; browser PNG/JPEG selection and upload are automated, while camera and native picker certification remain later evidence gates.

Exact declaration

export type Image = {
    kind: "image",
    uri: string,
    metadata: ImageMetadata,
}

Continue learning

Next steps

Content.uriContent.decodePick

Complete inventory

View all pages in Dynamic content
← Previous: Content.ImageMetadataNext: Content.PickOptions →