Although it may not seem like that but there is a little questions about this subject. I am not asking if I should use DB or filesystem, the file system it is, but I am asking what is the best way of organizing pictures in file system that will be used with asp.net application? I am talking about tens or even hundreds of thousands of picture.
To elaborate a question a bit.
- Where should repository be located, create another VD in IIS or in application VD, or somewhere outside IIS?
- How to organize file patsh, put them all in one folder or create subfolders. If so how to name all those folders?
- How to handle multiple sizes of the same image? where to locate them?
- How to sync folders and images with database?
- What else crosses your mind, and you think it's important..
I've done something myself allready, but I am asking if someone had some experience with this. Maybe it could be done better yours way.
I put things like this
I stored pictures in IIS folder, because storing them outside of iis make them unable to use in web, because of paths. You cannot use file path in web, it must be virtual file path.
http://images/1.jpg istead of C:\images\1.jpg
in the root I had subfolder for each picture size
root- +400x300 +600x400 +1024x768
Named images by id from database. If the ImageID from database is 45678909, the name of picture is 45678909.jpg an it's location is
VD\images\400x300\45\67\89\45678909.jpg
VD\images\600x400\45\67\89\45678909.jpg
I sliced the picture name two by two, and create subfolders. the point was not to have more than 100 files in folder. Was this good idea or stupid one? How would you organize this? For person, this organization with tons of folder is not easy to use.
- Name of the image with its relative path I saved in database table with description and time of insert etc. path: 45\67\89\45678909.jpg
Any suggestions or improvements?
Thanks :)