ImgproxyProvider

Generates imgproxy transformation URLs. Self-hosted, open-source image processing server.

use Timber\Chainsaw\Provider\Imgproxy\ImgproxyProvider;
use Timber\Chainsaw\Signer\Algorithm;
use Timber\Chainsaw\Signer\HmacUrlSigner;

// imgproxy ships the key and salt as hex strings; decode them once at boot.
$keyBin = hex2bin($_ENV['IMGPROXY_KEY']);
if ($keyBin === false) {
    throw new \InvalidArgumentException('IMGPROXY_KEY must be a hex-encoded string.');
}

$provider = new ImgproxyProvider(
    host: 'http://localhost:8081',
    signer: new HmacUrlSigner(key: $keyBin, algorithm: Algorithm::Sha256, stripPadding: true),
    salt: $_ENV['IMGPROXY_SALT'], // hex-encoded; the provider decodes + validates internally
);

Pass signer: null (the default) for unsafe URLs. Both signer and salt must be set together — otherwise the provider falls back to the unsafe segment.

stripPadding: true matches imgproxy’s base64.RawURLEncoding on the wire (no trailing =). Omitting it (the default) leaves padding intact, which is correct for imagor / thumbor but is rejected by imgproxy.

Output: {host}/{signature}/{segments}/plain/{source}@{ext}

Manipulation support

Legend: ✅ = implemented in Chainsaw, ⚠️ = supported with caveats, 🟦 = available on the CDN, not exposed by Chainsaw, ❌ = not available on this CDN.

Resize & crop

Manipulation Chainsaw Availability
Width Free
Height Free
Cover Free (crop() alias; rs:fill/fill-down + gravity — compass, focal & smart anchors free; face & object-class anchors need Pro; focal-zoom throws)
ManualCrop Free
Contain Free
Pad Free
Scale No scale-by-factor primitive; use width()/height()
Stretch Free
CropToRatio exar extends to a ratio inferred from w/h — no ratio-only crop; use cover() with dims
PadToRatio No ratio-only pad; use pad() with dims
Trim Free (color tolerance, symmetry)

Filters & effects

Manipulation Chainsaw Availability
Blur Free
Sharpen Free
Brightness Only with Pro (server rejects on free tier)
Contrast Only with Pro (server rejects on free tier)
Gamma Only with Pro (server rejects on free tier)
Pixelate Only with Pro (server rejects on free tier)
Greyscale Only with Pro (via sa:0; server rejects on free tier)
Sepia Only with Pro (via sa:0; server rejects on free tier)
Saturation Only with Pro (server rejects on free tier)
Hue Not emitted by Chainsaw
Negate Not emitted by Chainsaw
Monochrome 🟦 Only with Pro (intensity + color)
Duotone 🟦 Only with Pro (dark/light colors)
Colorize 🟦 Only with Pro
Unsharp mask 🟦 Only with Pro (mode, weight, divider)

Detection (Pro)

Manipulation Chainsaw Availability
Blur areas 🟦 Only with Pro (rectangular regions)
Blur detections 🟦 Only with Pro (by class name)
Draw detections 🟦 Only with Pro (bounding boxes)
Object gravity 🟦 Only with Pro (obj/objw)

Decoration & orientation

Manipulation Chainsaw Availability
Background Free
Background alpha 🟦 Free
Border ⚠️ Free, Expand/Shrink only — flattens transparent source pixels onto the border colour
Flip Free
Rotate ⚠️ Free; 90/180/270 only — arbitrary angles throw UnsupportedManipulator
AutoOrient Free; emits ar:1 (EXIF auto-orient is opt-in on imgproxy, unlike most CDNs)
Watermark Free tier uses IMGPROXY_WATERMARK_URL; Pro supports per-request URLs via wmu
Watermark text 🟦 Only with Pro (Pango markup)
Watermark size 🟦 Only with Pro
Watermark rotate 🟦 Only with Pro
Watermark shadow 🟦 Only with Pro
Gradient 🟦 Only with Pro (directional overlay)

Special

Manipulation Chainsaw Availability
BlurHash
ThumbHash
Dither
Strip metadata 🟦 Free
Keep copyright 🟦 Free
Strip color profile 🟦 Free
Color profile / ICC 🟦 Only with Pro
DPI 🟦 Only with Pro
SVG style injection 🟦 Only with Pro
PDF page selection 🟦 Only with Pro
Video thumbnail 🟦 Only with Pro (frame extraction)
Disable animation 🟦 Only with Pro
Resizing algorithm 🟦 Only with Pro (nearest, lanczos, etc.)
Enforce thumbnail 🟦 Free (HEIC/AVIF embedded)
Fallback image 🟦 Only with Pro
Max bytes 🟦 Free (auto quality degradation)
Cache buster 🟦 Free
URL expiration 🟦 Free

Encoding

Format Supported Notes
JPEG Progressive, subsampling (Pro)
PNG Interlacing, quantization (Pro)
WebP Smart subsampling, preset (Pro)
AVIF Subsampling control (Pro)
GIF
Auto format Format::Auto is silently ignored — set an explicit format or compose a <picture> with typed sources
Quality Per-format quality (Pro), autoquality (Pro)

Notes

  • Free vs Pro – Brightness, Contrast, Gamma, Greyscale, Sepia, Pixelate, and Saturation are imgproxy Pro features. They are only registered when the provider is constructed with pro: true; on the OSS version they throw UnsupportedManipulator.
  • Blur – range mapped from 0…100 to sigma (multiply by 0.5, minimum 1).
  • Sharpen – range mapped from 0…100 to sigma (multiply by 0.1, minimum 1).
  • Border – imgproxy has no native border primitive, so BorderType::Expand and BorderType::Shrink are simulated via pd:{width} (padding) + bg:{color} (background colour). Transparency caveat: imgproxy’s bg flattens every transparent source pixel onto the colour, not just the padded strip — so on PNG/WebP sources with alpha the “border” colour bleeds through the interior. BorderType::Overlay throws UnsupportedManipulator because the overlay contract (“don’t touch the interior”) cannot be honoured. Only Unit::Pixel is supported. If you need a true colour frame that preserves interior transparency, use a provider with a native border primitive (e.g. imgix).
  • Watermark – on the free tier, set IMGPROXY_WATERMARK_URL as a server environment variable. The provider only emits wmu:{url} when the watermark URL differs from the server default (Pro feature).
  • URL signing – HMAC path-based signing with hex-encoded key and salt.