Hierarchy
- ImageField
Methods
create
-
The method creates an image in the process context.
Parameters
-
name: string
Image name.
-
body: ArrayBuffer
Body of the file.
const fileRq = await fetch(`https://jpeg. org/images/jpegsystems-home.jpg`) const buf = await fileRq.arrayBuffer() const file = await Context.fields.image.create('home.jpg', buf)
Returns Promise<ImageItem>
-
createFromLink
-
The method uploads an image from an external source to the process context.
Parameters
-
name: string
Image name.
-
url: string
Link to the image.
const file = await Context.fields.image. createFromLink('home.jpg', `https://jpeg.org/images/jpegsystems-home.jpg`)
Returns Promise<ImageItem>
-
fetchAll
-
Request all associated images.
If a field stores multiple image links, you can request all of them at once:
const images = await Context.fields.images.fetchAll();
Returns Promise<ImageItem[]>
Description of the TImage type field