When a user uploads an image to my site, the image goes through this process;
- user uploads pic
- store pic metadata in db, giving the image a unique id
- async image processing (thumbnail creation, cropping, etc)
- all images are stored in the same uploads folder
So far the site is pretty small, and there are only ~200,000 images in the uploads directory. I realise I'm nowhere near the physical limit of files within a directory, but this approach clearly won't scale, so I was wondering if anyone had any advice on upload / storage strategies for handling large volumes of image uploads.
EDIT:
Creating username (or more specifically, userid) subfolders would seem to be a good solution. With a bit more digging, I've found some great info right here; http://stackoverflow.com/questions/191845/how-to-store-images-in-your-filesystem
However, would this userid dir approach scale well if a CDN is bought into the equation?