انتقل إلى المحتوى
#0279
Files

Every image size is a query string on the original

Your users upload product photos. You need WebP, three widths for srcset, and square crops for the grid. The usual answer is an image CDN subscription or a Sharp queue that someone has to babysit.

The files service does it on read. hero.jpg?thumbnail=&format=webp&width=800&q=80 returns the 800-wide WebP. &width=400 returns the small one. &size=300x300&resize=fill returns the square crop. Your <img srcset> is three variations of one URL pointing at one file on disk. Responses carry an hour of Cache-Control, so a CDN in front caches them like any static asset.

The original stays where it was uploaded. Nothing is pre-generated, nothing is stored twice, and a new breakpoint is a new query string, not a backfill job.

The image pipeline is a URL grammar, and the originals never move.