title: What is the most efficient way to store 500.000 images?
body: <p>I'm coding a basic gallery for a website with around 40.000 online people at any given time. Users will be able to create galleries and upload images.</p>
  
  <p>My question is, should I make a seperate folder for each gallery and put the images in them, or make a single folder and put all images in it, but keep the gallery_id for each image in the database? Or, should I make a directory for every user, then another directory inside them for the gallery names?</p>
  
  <p>How would you do this?</p>
  
  <p>Ps. I need it to be as light as it can.</p>