Image Parameters

Last updated

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

Parameters

Parameter Alias Values Default Description
o origin 1 — Return the original file, ignoring every other parameter
s size integer (px) — Short-edge length, proportional
w width integer (px) — Width
h height integer (px) — Height
q quality 0–100 WebP/JPG 75, AVIF 50 Output quality; unused for PNG
t type webp/avif/jpg/jpeg/png webp Output format; other values fall back to webp
d dark 1/0 0 Color 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

Order Condition Result
1 .pdf / .svg extension Original streamed as-is; all parameters ignored
2 o=1 Original streamed as-is
3 s present Scaled by short edge; w/h ignored
4 Both w and h Cropped to that size
5 Only w or h Scaled proportionally by that edge
6 None Long edge shrunk to 1024px when the short edge exceeds 1024px

See Sizing Rules for how each case computes dimensions.

Examples

# 480px short edge, quality 60, AVIF
curl -fsS -o a.avif "http://localhost:8080/c/img/blog/a.jpg?s=480&q=60&t=avif"

# Cropped 400x400 JPG
curl -fsS -o a.jpg "http://localhost:8080/c/img/blog/a.jpg?w=400&h=400&t=jpg"

# Original
curl -fsS -o origin.jpg "http://localhost:8080/c/img/blog/a.jpg?o=1"

# Missing image, dark 404 placeholder
curl -fsS -o missing.svg "http://localhost:8080/c/img/blog/none.jpg?d=1"
中文