Spec an on-demand image resizer for seller uploads
Your task
Your marketplace lets sellers upload product photos. A FastAPI service serves each photo at the size a page asks for, such as /img/{image_id}?w=320. It resizes on the first request and caches the result in S3 behind the CDN. An agent will build the resizing service.
Write the spec you would hand the agent.
What you know:
- Python 3.12, FastAPI and Pillow
- originals sit in a private S3 bucket, exactly as sellers uploaded them
- pages use 4 widths: 160, 320, 640 and 1280 pixels
- a new listing can get thousands of views in its first minute
Then, in a few sentences: what does "resize images to the requested width" get wrong when the files come from strangers?