Variant Profiles
Variant profiles assign a name to a reusable transformation. A profile keeps dimensions, format, and other image rules in server configuration instead of repeating them in each request.
This thumbnail profile:
- Produces a 128×128-pixel image
- Uses
fillresizing - Applies the source image's EXIF orientation
Define profiles in the top-level variant-profiles block:
variant-profiles {
thumbnail {
width = 128
height = 128
fit = fill
rotate = auto
}
}
Variant profiles use the same transformation parameters as the Fetch Asset API.
Usage
Supply the profile name in the profile query parameter:
GET /assets/users/123/profile-picture?profile=thumbnail
Overriding a Variant Profile
Individual transformation parameters in the request override matching values from the profile. This request uses the
thumbnail profile but changes its dimensions to 256×256 pixels:
GET /assets/users/123/profile-picture?profile=thumbnail&width=256&height=256
Restricting Transformations to Profiles
Set transform.on-demand-variant.mode to profile_only to reject on-demand transformations that do not use a profile:
paths {
"/**" {
transform {
on-demand-variant {
mode = profile_only
}
}
}
}
With profile_only, you must name a profile for transformed content. You can include explicit transformation parameters
if they resolve to the same transformation as that profile for the selected source image. A change to the profile's
resolved transformation returns 400 Bad Request. This permits the expanded parameters in service delivery URLs.
If the profile omits format, you can select the output format through Accept or the format parameter. Konifer
includes the selected format in returned service URLs. If the profile defines format, requests must use that format.
You can still retrieve unchanged original content without a profile. The default mode, enabled, accepts profiles and
individual transformation parameters, including overrides.