Imageset

[中文]

Overview

The imageSet descriptor describes a set of image resources. A document can reference an imageSet in root.json.assets, and the Runtime can also register_image_file/json(...) to register all of its images globally so that ${image.<id>} can be used in imageProps.src.

Image resources are always organized into imageSet.images[], even for a single image.

Field Table

Key

Type

Default

Required

Description

type

string

none

Yes

Fixed to "imageSet"

images

object[]

none

Yes

Image descriptor list; cannot be empty

images[].id

string

none

Yes

Image resource id

images[].src

string

""

No

Image file path; resolved relative to the imageSet file directory

images[].width

integer px

0

No

Source image width; used for image sizing

images[].height

integer px

0

No

Source image height; used for image sizing

An images[] entry does not contain type. Duplicate ids cannot appear within one imageSet.

Runtime API

  • register_image(...)

  • unregister_image(...)

  • register_image_json(...)

  • register_image_file(...)

  • list_image_resources(document_id)

register_image_json/file(...) registers all images in an imageSet; if any one fails to register, the images registered this time are rolled back.

Document image resources take priority over Runtime global images; Runtime global images supplement image ids a document does not declare.

Example

{
    "type": "imageSet",
    "images": [
        {
            "id": "logo",
            "src": "../../../../../docs/_static/brookesia_logo.png",
            "width": 3409,
            "height": 834
        }
    ]
}