I run a small AI-photo-prompt gallery — a few hundred prompts, each with an example image. It started as a weekend project and grew faster than the infrastructure did. By the time I looked properly, the images directory was 1.1 GB across 2,650 files, and a single gallery page was shipping 2–3 MB of images to phones on Indian mobile data.
This is the writeup of getting that under control, and the three things that surprised me along the way — including one bug that cost me an hour and had nothing to do with images at all.
The measurement that reframed the problem
My first instinct was "the JPEGs are too big, crank the compression." I was wrong. The actual breakdown:
Format






