For a media or e-commerce site with hundreds of thousands of pages, images are usually the heaviest part of every page and the largest share of storage. Templates need several sizes, and phones and high-density screens need different files. Storing every size of every image in advance multiplies storage quickly.
For large sites, generating image sizes on demand from a single stored original, caching each result at the CDN and serving modern formats through responsive image markup is usually faster to run and cheaper to store than generating every size in advance.
This article explains why image delivery matters for speed and costs, compares the main pipeline designs, covers formats, responsive markup, caching and security, and shows how a food site with 1.7 million recipes moved 250 GB of images to an on-demand pipeline. It does not cover photo editing or digital asset management workflows for creative teams.
Key takeaways
- Images are often the largest element on a page and a frequent cause of slow loading, which affects user experience and search visibility.
- Three pipeline designs are common: sizes generated at upload, sizes generated on demand by a service such as Thumbor or imgproxy, and a managed image CDN.
- On-demand resizing stores one original per image and creates each size only when first requested, then caches it.
- Serve WebP or AVIF where browsers support them, and use srcset and sizes so each device downloads only the size it needs.
- Sign image URLs, so nobody can use your resizing service to generate unlimited variants.
- The Daily Meal moved 250 GB of images to a dedicated server with a Thumbor-based resizing pipeline as part of an infrastructure change that cut hosting costs about fivefold.
Why image delivery matters
Google's Largest Contentful Paint metric measures how long the main content of a page takes to appear, and web.dev defines a good result as 2.5 seconds or less for at least 75% of page loads. On article and recipe pages, the largest element is very often a hero image. An oversized or uncompressed hero photo can push the page past that threshold on mobile connections, whatever else the team optimizes.
Images also drive costs. Every unnecessary kilobyte is paid for in CDN bandwidth, and every pre-generated size is paid for in storage and backups.
Three pipeline designs compared
| Design | How it works | Strengths | Limits |
|---|---|---|---|
| Generate at upload | When an image is uploaded, the system creates every size and format the templates need | Simple to serve, no processing at request time | Storage multiplies, and a new template size means reprocessing every image |
| On-demand resizing service | One original is stored. A service such as Thumbor or imgproxy creates each variant when first requested, and the CDN caches it | One stored file per image, new sizes without reprocessing, smart cropping | Needs a service to run and scale, first requests are slower |
| Managed image CDN | A commercial service stores or fetches originals and transforms them at the edge | Little to operate, global performance | Ongoing fees that grow with traffic and transformations, less control |
The storage arithmetic shows why large sites move away from generating everything at upload. A site with 1.7 million recipes, each with one main photo needed in six sizes and two formats, would store about 20 million pre-generated files. With on-demand resizing, it stores 1.7 million originals, and the CDN holds only the variants visitors actually request.

Choosing formats
| Format | Use for | Notes |
|---|---|---|
| AVIF | Photos where the smallest file matters | Very good compression, slower to encode |
| WebP | Photos and graphics | Broad browser support, good compression |
| JPEG | Fallback for photos | Universal support |
| PNG | Graphics that need lossless quality or transparency | Large for photos |
| SVG | Logos, icons and simple illustrations | Scales without loss, tiny files |
Let the pipeline choose the format per request based on what the browser accepts, so templates do not need to know about formats at all.
Responsive images in templates
- Use srcset and sizes. List several widths of the same image and describe how wide it appears in the layout, so the browser downloads the smallest file that looks sharp.
- Set width and height. Declaring dimensions lets the browser reserve space and prevents layout shifts while images load.
- Lazy-load below the fold. Images further down the page load as the reader scrolls, while the hero image loads immediately with high priority.
- Crop for the layout. Use art direction or smart cropping so a wide hero image does not lose its subject on a narrow phone screen. Thumbor, for example, can detect faces and important features to choose the crop.
- Keep alt text meaningful. Optimization should never remove descriptive text that screen reader users depend on.
Heavy images slowing your pages and inflating your bills? We design image pipelines, caching and CDN setups for large content sites.
Explore IT outsourcingCaching, security and operations
- Cache at the CDN. Each variant URL is cached at the edge, so the resizing service handles only the first request for each size.
- Use stable, versioned URLs. Include a version or content hash in the URL so updated images get new URLs and old ones can be cached for a long time.
- Sign URLs. On-demand services can be abused to generate endless variants. Thumbor supports URLs signed with a secret key, so only sizes your templates generate are accepted.
- Limit sizes and formats. Allow a fixed list of widths and qualities instead of any number a URL might request.
- Protect originals. Keep originals in storage that the public cannot reach directly, with backups.
- Monitor. Track CDN hit ratio, resizing latency, errors and storage growth.
A real migration: 250 GB of images at The Daily Meal
The Daily Meal, a US food site with 30–50 million monthly page views, 2.5 million unique users and 1.7 million recipes, stored over 250 GB of image assets on a customized AWS setup that struggled with speed, uptime and cost.
As part of a wider infrastructure project, .wrk:
- Moved the site to a managed Drupal platform and built caching at the application and Akamai CDN levels.
- Relocated 250 GB of images to a dedicated asset server with a custom Thumbor-based image processing solution that resizes images as they are requested.
- Optimized advertisement loading to reduce its impact on page rendering.
- Set up a disaster recovery environment on AWS running in parallel.
Monthly hosting costs dropped about fivefold. The share of HTML responses delivered in 0.5 seconds or less rose to 80%, up from 50%, and the share of full page loads finishing within 7 seconds rose to 60%, up from 20%. The development and release process now needs only two or three developers. Read The Daily Meal case study.

How to migrate an existing image library
- Inventory originals. Find the largest, highest-quality version of every image, and note where templates reference each one.
- Move originals to one store. Copy them to dedicated storage with backups, keeping old paths working through redirects or a mapping table.
- Introduce the resizing service behind the CDN, starting with one template or section.
- Update templates to request sizes through the service with srcset and sizes.
- Measure. Compare page weight, Largest Contentful Paint, CDN hit ratio and bandwidth costs before and after.
- Retire old renditions once all templates use the new pipeline.
Image delivery is one part of a wider caching design. Our guide to caching strategies covers the application and CDN layers, and our article on load testing explains how to check the result under traffic.
Frequently asked questions
What is an image optimization pipeline?
An image optimization pipeline stores original images and delivers each visitor a version resized, compressed and converted to a suitable format for their device, usually through an image processing service and a CDN, without manual editing.
What is Thumbor?
Thumbor is an open-source image service that crops, resizes and applies filters to images on demand, with smart cropping based on detected faces and features. It is usually placed behind a CDN, which caches each generated size.
Should I generate image sizes at upload or on demand?
Generating at upload suits smaller sites with few templates. On-demand resizing suits large libraries, because it stores one original per image and creates new sizes without reprocessing everything when templates change.
Which image format is best for websites?
AVIF and WebP give the smallest files for photos, with JPEG as a fallback for older browsers. Use SVG for logos and icons. A pipeline that picks the format per browser request removes the decision from templates.
How do images affect Core Web Vitals?
Large or slow images often determine Largest Contentful Paint, and images without declared dimensions can cause layout shifts. Right-sized, modern-format images with dimensions set and priority given to the hero image improve both.
To sum up
Large sites should store each image once and let a resizing service and a CDN deliver the right size and format to every device. Use srcset and sizes in templates, sign image URLs, cache aggressively and measure page speed and costs before and after. For a site with hundreds of gigabytes of images, the pipeline is one of the biggest levers on both speed and hosting costs.
.wrk improves the speed and running costs of large content and media sites in the US and Europe, with image pipelines, caching, hosting migrations and performance testing.
Planning to fix image delivery on a large site? Share your traffic, image library and stack, and we will propose a pipeline and migration plan.
Explore IT outsourcing