CDN



On-the-fly image resizing with Nginx

Available to Premium members only
  • avatar
  • 1.5K Views
  • 9 mins read
Preview image

If you've ever managed a web server that serves images to thousands of users, you've probably run into the problem of serving the right image size to the right context. A 1200x800 hero image looks great on a desktop, but it's pure waste on a mobile screen or a thumbnail grid. The traditional answer to this has been generating multiple image variants at upload time, but that approach gets messy fast. A cleaner and more flexible solution is to resize images directly at the server level, on demand, using nothing more than nginx and its built-in image filter module. This guide walks you through setting that up from scratch, including caching so your server isn't processing the same image twice.

Image optimization for the web

Available to registered members only
  • avatar
  • 272 Views
  • 18 mins read
Preview image

Images are almost always the heaviest thing on a web page. A single hero photo can weigh more than all the HTML, CSS and JavaScript of a site put together, and every extra kilobyte delays the moment a visitor finally sees something useful. Search engines notice it, and users on mobile data notice it faster. The encouraging part is that image delivery is one of the few areas where the fixes are well documented, mostly automatable, and visible in the metrics almost immediately.