An interesting question has ripened, we have a user base , each of them has the opportunity to create their own gallery , or even several.
How best , on the part of speed and reliability , to create a data storage structure. I think between the two options - to give the entire load on the database , or more on the file system .
In the first case: All photos are stored in a shared directory , links to images are placed in the database .
In the second: for each user we create our own directory in which the images are loaded, and when retrieving a photo, we simply scan it and display everything that has the appropriate resolution. In parallel, there is a database with the name of the files - for deletion.