I'm working on an application which will store around 50.000 images within it's first year and another 75.000 in it's second. Images can come from Galleries, news images, article images and profile images. So I want to give each image a GUID and store the GUID in the database.
As for the directory structure i was thinking of something like this:
~/Upload/Images/F2/50/F2504E0-4F89-11D3-9A0C-0305E82C3301.jpg
So I'm using the first 4 characters of the GUID as my directory structure to spread images a bit more evenly between directories.
Now I have some questions about this approach:
- Is it considered good practice to store all different kinds of images together rather then use
~/Images/Upload/Profiles
,~/Images/Upload/Articles
etc. - I'm also storing thumbnails and they have a different GUID obviously so the thumbs will not be in the same folder as the original and somehow that doesnt give me a good feeling but I guess it should not matter but.
- Same goes for Galleries, I'm used to store galleries in folders like
~/Images/Upload/Galleries/12
, and now all the images from a gallery will be scattered around in different subfolders, is this a big performance hit? - Do you guys have any other ideas for directory structures?
As you can probably see I'm a bit afraid to use this approach but since there will be lots of images maybe even more then the numbers i gave i have to let the control go I think :)
Please give me your opinions on this thank you very much.
Kind regards, Mark
Edit:
Forgot to mention, images will be deleted fairly often also