Strategy for managing lots of pictures for a website

Posted by Nate on Programmers See other posts from Programmers or by Nate
Published on 2011-03-20T02:26:00Z Indexed on 2011/03/20 8:16 UTC
Read the original article Hit count: 388

Filed under:

I'm starting a new website that will (hopefully) have a lot of user generated pictures. I'm trying to figure out the best way to store and serve these pictures.

The CMS I'm using (umbraco) has a media library that puts a folder on the server for each image. Inside of there you can have different sizes of that same image. That folder has an ID on it and the database has additional information for that image along with the ID of the folder.

This works great for small sites, but what if the pictures get up to 10,000, 100,000 or 1,000,000? It seems like the lookup on the directory would take a long time to find the correct folder. I'm on windows 2008 if that makes a difference.

I'm not so worried about load. I can load balance my server pretty easily and replicate the images across the servers. The nature of the site won't have a lot of users on it either, but it could have a lot of pics.

Thanks.

-Nate

EDIT
After some thought I think I'm going to create a directory for each user under a root image folder then have user's pictures under that. I would be pretty stoked if I had even 5,000 users, so that shouldn't be too bad of a linear lookup. If it does get slow I will break it down into folders like /media/a/adam/image123.png.

If it ever gets really big I will expand the above method to build a bigger tree. That would take a LOT of content though.

© Programmers or respective owner

Related posts about web-development