CloudflareProvider

Generates Cloudflare Images transformation URLs.

use Timber\Chainsaw\Provider\Cloudflare\CloudflareProvider;

$provider = new CloudflareProvider(
    host: 'https://example.com',
);

Output: {host}/cdn-cgi/image/{options}/{source}

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
Scale No scale-by-factor primitive; use width()/height()
Cover Free; crop() is a fluent alias. Anchors: compass (gravity=top|left…), focal (gravity=XxY), auto (smart), face
ManualCrop Free (via trim.* parameters)
Contain Free
Pad Free
Stretch Free (via fit=squeeze)
CropToRatio No aspect-ratio-only crop; use cover() with absolute dims
PadToRatio No aspect-ratio-only pad; use pad() with absolute dims
Trim Free
Zoom (face crop) 🟦 Free (gravity=face + zoom)

Filters & effects

Manipulation Chainsaw Availability
Blur Free
Sharpen Free (range 0–10)
Brightness Free (multiplier, not -100…100)
Contrast Free (multiplier)
Gamma Free
Pixelate Only with Workers
Greyscale Free (via saturation=0)
Sepia No colorize filter in URL API
Saturation Free
Segment (AI background removal) 🟦 Free (gravity=segment)

Decoration & orientation

Manipulation Chainsaw Availability
Background Free
Border Only with Workers
Flip Free
Rotate ⚠️ Free; 90/180/270 only — arbitrary angles throw UnsupportedManipulator
AutoOrient Free; EXIF orientation applied implicitly by default
Watermark Only with Workers

Special

Manipulation Chainsaw Availability
BlurHash
ThumbHash
Dither
Metadata control 🟦 Free (metadata=keep|none|copyright)
Animation control 🟦 Free (anim=false to strip frames)

Encoding

Format Supported
JPEG
PNG
WebP
AVIF
GIF
Auto format
Quality

Notes

  • Color encoding – hex colors are URL-encoded with %23 prefix (e.g. background=%233b82f6).
  • Format mapping – Cloudflare’s URL API recognizes only jpeg (Chainsaw maps jpgjpeg), webp, avif, and auto. There is no format=png or format=gif value, so an explicit PNG or GIF request is silently ignored – the format parameter is simply omitted and the source format passes through unchanged (no UnsupportedManipulator is thrown). Auto format emits format=auto, letting Cloudflare negotiate the best supported format per request from the client’s Accept header.
  • Brightness/Contrast – converted from Chainsaw’s -100…100 to Cloudflare’s multiplier scale.
  • Sharpen – range mapped from 0…100 to Cloudflare’s 0…10 range.
  • Greyscale – mapped to saturation=0.01 (not 0). Cloudflare’s saturation=0 codepath forces JPEG output and ignores format=, which silently drops the alpha channel and fills transparent pixels with black. 0.01 is visually indistinguishable from pure greyscale and keeps the source format (and thus alpha) intact. saturation(-100) receives the same rewrite.
  • Sepia/Pixelate/Hue/Negate – absent from both the URL API and Workers image transforms; throw UnsupportedManipulator.
  • Border and Watermark are only available through the Workers API, not the URL API; they also throw UnsupportedManipulator under this provider.
  • Segment is an AI-based feature that isolates the subject and replaces the background with transparency.
  • Signing is managed by Cloudflare at the CDN level (no client-side signing).