
NewsTechnology
Media Management at Scale: R2 Storage + Cloudflare Images in Payload CMS
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:
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 devGallery: Grid Mode Example
Sample Gallery — Grid Layout






Custom HTML Embed Example
Comments
Related Posts

TechnologyEngineering
1 min
Real benchmarks, D1 architecture, and a production deploymen…

Design
1 min
Spatial design, oklch() color systems, semantic motion, and …

Business
1 min
ROI analysis, migration strategy, and cost breakdown for ent…