📖
Etherna Docs
  • Get Started
  • Schema
    • Image
    • Profile
    • Video
    • User's playlists
    • Playlist
Powered by GitBook
On this page
  • Info
  • Schema versions
  • Schema v2
  • example:
  • Schema v1
  • sources field example
  1. Schema

Image

Info

The info for any image is a part of JSON objects containing information about the image in various resolutions and a blur-hash version for the loading placeholder.

An image might be a straight image with only a reference with the original image, or a responsive image. A responsive image has multiple references in the property sources which is a dictionary of size + reference of each responsive images, while a single image has only 1.

Schema versions

Schema v2

type SwarmImage = {
  /** Image aspect ratio (width / height) */
  aspectRatio: number
  /** Blurhash value  */
  blurhash: string
  /** Sources of image in different resolutions */
  sources: Array<{
    /** Image scaled width */
    width: number
    /** Image type */
    type: "jpeg" | "png" | "webp" | "avif"
    /** Image path */
    path: string
  }>
}

Each source must have either path or reference field.

example:

{
    aspectRatio: 1.77777777778,
    blurhash: "LEHV6nWB2yk8pyo0adR*.7kCMdnj",
    sources: [
        {
            width: 1280,
            type: "png",
            path: "thumbnail/1280w"
        }
    ]
}

Schema v1

type SwarmImage= {
  /** Image aspect ratio (width / height) */
  aspectRatio: number
  /** Blurhash value  */
  blurhash: string
  /** Sources of image in different resolutions */
  sources: {
    [size: `${number}w`]: string
  }
}

sources field example

{
  "480w": "<reference hash>",
  "768w": "<reference hash>",
  "1024w": "<reference hash>",
  "1536w": "<reference hash>",
}

At this point in time every image generated is a responsive image (user avatar, user cover, video thumbnail).

PreviousGet StartedNextProfile

Last updated 1 year ago