Skip to content

Comments

Add image optimization guide and playground example#1045

Open
joefairburn wants to merge 2 commits intoredwoodjs:mainfrom
joefairburn:frontend-image-optimization
Open

Add image optimization guide and playground example#1045
joefairburn wants to merge 2 commits intoredwoodjs:mainfrom
joefairburn:frontend-image-optimization

Conversation

@joefairburn
Copy link
Contributor

Summary

  • Adds a documentation guide (docs/guides/frontend/images.mdx) covering image optimization with Cloudflare Image Transformations and a responsive <Image> component
  • Adds a playground/images example demonstrating the guide in a working RedwoodSDK app

What's in the playground example

  • /_image/* transform route — Worker route that reads ?w= and ?q= query params, rewrites the path to a static file, and fetches with cf.image options (width, quality, scale-down fit)
  • <Image> component — Responsive React component that generates srcSet entries across common device widths (640–3840px), capped at 2x the base width. Supports fill mode, priority loading (eager + fetchpriority="high"), and an unoptimized escape hatch for SVGs
  • Usage examples — Hero image with priority, card thumbnail with responsive sizes, fill-mode banner, and unoptimized SVG

Test plan

  • npm run check passes (types clean)
  • npm run build succeeds
  • E2E tests pass in dev mode (3 smoke tests: renders, transform route, srcSet generation)
  • Deployment tests (require Cloudflare credentials)
  • Verify docs render correctly in Astro

@joefairburn joefairburn force-pushed the frontend-image-optimization branch from 47b1c28 to 90db000 Compare February 16, 2026 15:27
@peterp
Copy link
Member

peterp commented Feb 16, 2026

This might be best as a community playground, then you don't have to have tests for it. Since it's 3rd party functionality that's OK.

@joefairburn joefairburn force-pushed the frontend-image-optimization branch 2 times, most recently from 41f4654 to 880bc40 Compare February 16, 2026 19:55
@joefairburn
Copy link
Contributor Author

This might be best as a community playground, then you don't have to have tests for it. Since it's 3rd party functionality that's OK.

Absolutely - moved it to community now!

joefairburn and others added 2 commits February 24, 2026 13:10
Add guide for using Cloudflare Images with a reusable <Image> component,
covering static files, R2 buckets, and external origins.
Adds a community playground demonstrating responsive image optimization
using Cloudflare Image Transformations and a custom <Image> component
with srcSet generation, priority loading, fill mode, and an unoptimized
escape hatch for SVGs.
@joefairburn joefairburn force-pushed the frontend-image-optimization branch from 880bc40 to ae218d9 Compare February 24, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants