Names the widths the site's own images come in. Every image the API serves (avatars, covers, thumbnails, attachments, proxied images) takes ?w= and answers a copy scaled down to it, so a card or an avatar doesn't load the upload at full size. The frontend builds those URLs from this list (imageSrcSet in src/utils/shared/urls.ts) and the server makes no other width (serveImage in api/lib/upload.ts), which bounds what it keeps.

Functions

f
parseImageWidth(raw: string | null): ImageWidth | null

Returns the width a ?w= value asks for, snapped to IMAGE_WIDTHS, or null when it is absent or not a positive number, which asks for the image as it is.

f
snapImageWidth(width: number): ImageWidth

Returns the narrowest of IMAGE_WIDTHS that covers width pixels, or the widest when none does.

Type Aliases

Variables

v
IMAGE_WIDTHS: 128 | 320 | 640 | 960[]

The widths, in pixels, smallest first: an avatar on a dense screen, a small cover, a card on a phone, and the widest feed card on a dense screen.

v
MAX_IMAGE_WIDTH: ImageWidth

The largest of IMAGE_WIDTHS, which a thumbnail never exceeds.