A string representing the image URL, a file upload ID, or an options object.
The URL for the image.
The ID of the file upload.
The caption as a string, an array of strings, or an array of rich text objects.
An image block object compatible with Notion's API, or null if the URL/ID is invalid.
// Use with a string
const simpleImage = block.image.createBlock("https://i.imgur.com/5vSShIw.jpeg");
// Use with a file upload ID
const fileUploadImage = block.image.createBlock("123e4567-e89b-12d3-a456-426614174000");
// Use with options object for external image
const complexImage = block.image.createBlock({
url: "https://i.imgur.com/5vSShIw.jpeg",
caption: "A beautiful landscape"
});
// Use with options object for file upload
const fileUploadImage = block.image.createBlock({
id: "123e4567-e89b-12d3-a456-426614174000",
caption: "A beautiful landscape"
});
Creates an image block.