Cloudflare R2 Image Optimization

Stop Serving Full-Size Images. Build a Smarter Edge.

I set up Cloudflare R2 as your image CDN with on-demand resizing. Your WordPress site stops generating dozens of thumbnail sizes on upload. Instead, R2 generates exactly the size each visitor needs, caches it at the edge, and serves it in under 50ms globally.

Delivered by Gatilab • Backed by 800+ client projects & 16 years of hands-on WordPress experience.

Custom R2 Bucket Custom domain + pull-through caching.
On-Demand Resize Any WxH variant, generated once, cached forever.
Edge URL Rewriting Uploads, themes, plugins served from R2.

Origin overload

Every request hits PHP and your bandwidth allocation. Images alone can easily saturate a busy server.

Wasted storage

WordPress pre-generates thumbnails nobody requests. It sits there, eating disk space and slowing down backups.

Missing sizes

When a requested size doesn’t exist, WordPress serves the massive original, tanking Core Web Vitals.

CDN gaps

Most CDNs only cache what exists. They don’t generate missing images, resulting in broken visuals or massive fallbacks.

The Modern R2 Edge Toolkit

Zero bill surprises. Zero origin load. Zero missing thumbnails.

A system where Cloudflare R2 stores your images and an Edge Worker handles all intelligence. Existing files serve instantly; missing sizes generate on the fly.

Generate any size, instantly

Request hero-800x600.webp. If it doesn’t exist, the Worker detects the WxH pattern, commands your server to process the original, stores it to R2 permanently, and serves it. The first visitor waits 1s. Every subsequent request is instant.

Zero Plugin Bloat

We use a lightweight mu-plugin. No settings, no DB tables—just one PHP file with a secure, secret-protected endpoint.

Pull-Through Cache

Your CSS, JS, fonts, and PDFs all run through R2. If it’s missing, the Worker pulls it, caches it, and serves from edge next time.

01

Audit & Baseline

I review your hosting, CDN, media library size, and existing thumbnail footprints to measure current wasted storage.

02

R2 & Worker Setup

I provision the custom R2 bucket attached to your domain and write the Edge Worker for on-demand image processing.

03

WordPress Integration

I attach the mu-plugin that rewrites all assets to your R2 domain and exposes the private resize endpoint.

04

Migration & Validation

I sync existing uploads to R2, verify global CDN hits, and deliver a before/after report detailing the improvements.

Real Results From a 47K Image Site

A content site replaced their VPS file serving with our R2 setup. No more bulk regenerations.

0 GB Origin Bandwidth
45ms Edge TTFB Average
23 GB Dead Storage Cleared
<$5 Monthly R2 Cost

Implementation Pricing

Costs depend entirely on your site’s scale, traffic logic, and multi-domain requirements.

Standard

Single Site

Single WordPress site with R2 bucket, Edge Worker, mu-plugin, and full upload sync.

Get Started
Enterprise

Multi-Domain

Fleet-wide R2 architecture with centralized assets, advanced edge intelligence, and SLA metrics.

Get Started

Common Questions

How much does Cloudflare R2 storage cost?

R2 pricing is straightforward: $0.015 per GB stored per month with zero egress fees. Most CDNs charge for data served; R2 doesn’t. A 20,000-image WordPress site averages $0.30 per month.

Will this break my existing images and thumbnails?

No. The URL rewriting is transparent. Existing image URLs continue to work perfectly, serving from R2 instead of your origin. It’s completely non-destructive.

Do I need a paid Cloudflare plan?

R2 and the required Workers function beautifully on Cloudflare’s free tier for the vast majority of sites (up to 100k requests/day for Workers).

Can I still upload through WordPress?

Yes. Nothing changes inside your WordPress dashboard. The pull-through Worker automatically handles caching requested images to R2 without impacting your standard workflow.

Let’s Offload Your Media Library

Fill out the brief with your domain and estimated media library size. We’ll outline precisely how much origin load and storage you can eliminate.