Skip to content

QinoImage

An image field once read, shaped like Next's StaticImageData.

View Markdown

Fields a primitive's media declares as images are read as a QinoImage, not a URL.

@qino/cms
import type { QinoImage } from "@qino/cms";

type QinoImage = {
  src: string;
  width: number;
  height: number;
  blurDataURL?: string;
  blurWidth?: number;
  blurHeight?: number;
};

Fields

FieldDescription
srcThe URL stored in the file, starting with /
widthWidth in pixels, with EXIF orientation applied
heightHeight in pixels, with EXIF orientation applied
blurDataURLA base64 data URL of the image, 8px on its long side. JPEG, PNG, WebP, AVIF
blurWidthWidth of the blur image. JPEG, PNG, WebP, AVIF
blurHeightHeight of the blur image. JPEG, PNG, WebP, AVIF

It's assignable to Next's StaticImageData, so it can be passed as src to next/image.

Example

src/components/cover.tsx
import type { QinoImage } from "@qino/cms";
import Image from "next/image";

export function Cover({ image }: { image: QinoImage }) {
  return <Image src={image} alt="" placeholder="blur" />;
}