Landscape — product showcase
NewsTechnology

Media Management at Scale: R2 Storage + Cloudflare Images in Payload CMS

1 min

The Media Pipeline

Every image in Digi37 flows through a pipeline: Upload → R2 Storage → Cloudflare Images → Edge Cache → User. Each step is optimized for speed and cost.

R2: Zero Egress Storage

R2 is S3-compatible object storage with zero egress fees. For media-heavy sites, this alone can save thousands per month:

  • $0.015/GB/month storage
  • $0.00 egress — unlimited bandwidth
  • S3-compatible API — works with existing tools
  • Automatic multi-region replication

Cloudflare Images API

Instead of generating thumbnails at upload time, we use on-the-fly transformation:

TypeScript
1// Transform images via URL params2const optimized = `https://imagedelivery.net/${accountId}/${imageId}/w=800,h=600,fit=cover,format=auto`3 4// Payload integration (custom sharp replacement)5// Runs at upload time in production, client-side in dev

Gallery: Grid Mode Example

Sample Gallery — Grid Layout

Hero banner — modern technology
Hero banner — creative workspace
Landscape — urban architecture
Landscape — natural scenery
Landscape — team collaboration
Landscape — product showcase

Custom HTML Embed Example

NewsTechnology

Comments

0/2000

Related Posts