function imageProps
imageProps(
url: string,
sizes: number | string
): { src: string; srcSet: string; sizes: string; }

Returns what an <img> needs to load url, one of the API's images, no larger than it is shown: a srcset of the copies the server makes (shared/image.ts), from which the browser takes the narrowest that fills sizes on its screen, and a src for whatever reads only that. sizes is the width the image is laid out at, in CSS pixels, or a sizes attribute when that width follows the viewport's. Avatar, Thumbnail and the playlists' covers spread it on their image.

Parameters

url: string
sizes: number | string

Return Type

{ src: string; srcSet: string; sizes: string; }

Usage

import { imageProps } from "src/utils/shared/urls.ts";