Possible duplicate:
Saving a large number of images
Hello,
I want to be able to scale millions of user profile photos on my LAMP server using PHP.
Currently, I save all the images in one folder, which is a big no-no, so I want to decompose them into many folders and subfolders (e.g. aa / bb / etc ...).
What is the best and most effective way to do this, especially if I don't want to call the database to get the file name / path for this user profile?
I'm thinking of making a username hash and using the first 4 letters of this hash to generate / find the path for this user profile profile, so I would not need anything accessible from the database since I will always have a username. So, for example, if the first 4 characters of the user's username hash were “aabb”, I would save this pic user profile as aa / bb / username / profile.jpg, which theoretically allows me to scale millions of users without adding anything to the database, evenly distributing all the images throughout the aa / bb / folder structure.
Any ideas / input?
Thank!
source
share