URL parameters

Resizing and fit

Append query parameters to any image URL to transform it on the fly. Every combination is cached separately, so a given URL always returns the same bytes.

Parameters

ParameterValuesDefaultDescription
wpositive integeroriginal widthTarget width in pixels. Snapped to your site’s configured width list (see below).
hpositive integerproportionalTarget height in pixels. Also snapped to your site’s width list.
dpr1, 2, 31Device pixel ratio. Multiplies the pixel dimensions for high-density screens.
fitcover, contain, insidecoverHow the image fills the requested box (see below).

Examples

/photos/hero.jpg?w=768            → 768px wide, height proportional
/photos/hero.jpg?w=480&h=480     → fit a 480×480 box (cover, default)
/photos/hero.jpg?w=640&dpr=2     → 1280 device pixels wide
/photos/hero.jpg?w=768&fit=inside → fit within 768px, no cropping

Fit modes

  • cover — fill the box, cropping any overflow. Best for thumbnails and fixed-size slots.
  • contain — fit the entire image inside the box without cropping, adding padding as needed to match the box.
  • inside — shrink to fit within the box, preserving aspect ratio, with no padding (the output can be smaller than the box).

Images are never enlarged past their original size — request a width larger than the source and you are served the source at its own size, in any fit mode.

Format is chosen for you

You never pass a format. CDN.MN reads the browser’s Accept header and serves the best modern format enabled in your site’s optimization settings — AVIF, then WebP (both on by default) — falling back to a broadly compatible format (JPEG, or PNG when the source is a PNG or has transparency) — with the right one cached per browser capability. Old browsers keep working; modern ones get the smallest file automatically. Animation is not preserved: an animated source is served as a single still frame.

Quality is a site setting, not a URL parameter

Quality is fixed per site in your dashboard, not accepted from the URL. This is deliberate: a free-form quality value would multiply one image into thousands of near-identical cached variants, so it is not part of the URL contract. Change the quality for a site in its optimization settings — new requests re-render at the new quality automatically, no purge needed.

Width snapping

Each site has a configured list of allowed widths. A requested w or h rounds up to the smallest configured width that covers it (and is capped at your largest configured width). This keeps the number of cached variants bounded and predictable — request w=805 and you’ll be served (and billed for) the next configured size up, not a brand-new variant. Set the width list in your site’s optimization settings to match your layout’s breakpoints.

URL parameters — CDN.MN