Image Parameters

Last updated


This page lists the query parameters GET /c/img/{path} accepts, their defaults, and their precedence.

Parameters


ParameterAliasValuesDefaultDescription
oorigin1—Return the original file, ignoring every other parameter
ssizeinteger (px)—Short-edge length, proportional
wwidthinteger (px)—Width
hheightinteger (px)—Height
qquality0–100WebP/JPG 75, AVIF 50Output quality; unused for PNG
ttypewebp/avif/jpg/jpeg/pngwebpOutput format; other values fall back to webp
ddark1/00Color scheme of the 404 image when the file is missing

When a short name and its alias both appear, the short name wins (?s=200&size=400 uses 200).

Precedence


OrderConditionResult
1.pdf / .svg extensionOriginal streamed as-is; all parameters ignored
2o=1Original streamed as-is
3s presentScaled by short edge; w/h ignored
4Both w and hCropped to that size
5Only w or hScaled proportionally by that edge
6NoneLong edge shrunk to 1024px when the short edge exceeds 1024px

See Sizing Rules for how each case computes dimensions.

Examples


  1. # 480px short edge, quality 60, AVIF
  2. curl -fsS -o a.avif "http://localhost:8080/c/img/blog/a.jpg?s=480&q=60&t=avif"
  3. # Cropped 400x400 JPG
  4. curl -fsS -o a.jpg "http://localhost:8080/c/img/blog/a.jpg?w=400&h=400&t=jpg"
  5. # Original
  6. curl -fsS -o origin.jpg "http://localhost:8080/c/img/blog/a.jpg?o=1"
  7. # Missing image, dark 404 placeholder
  8. curl -fsS -o missing.svg "http://localhost:8080/c/img/blog/none.jpg?d=1"
中文