Notion Helper - v1.3.29
    Preparing search index...

    Function createBlock

    • Creates an image block.

      Parameters

      • options: string | Object

        A string representing the image URL, a file upload ID, or an options object.

        • string
        • Object
          • url

            The URL for the image.

          • id

            The ID of the file upload.

          • caption

            The caption as a string, an array of strings, or an array of rich text objects.

      Returns Object | null

      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"
      });