0

I'm wondering what the best practice is for photo storage. I'm in the business of storing photos with a user. Each user can have up to 35 photos and we currently have around a 100k users. I currently reference the photo's from a database.

My proposed solution is a hash of the photo name like so.

f56c0de1c61fdb926e79e8a0a65bd12930c9.jpg

broke out into directories like so

Photo 1

f5/6c/0d/e1c61fdb926e79e8a0a65bd12930c9.jpg
f5/6c/0d/e1c61fdb926e79e8a0a65bd12930c9_thumb.jpg

Photo2

ec/1c/55/bfb660548a6770238668c4b117d92f.jpg
ec/1c/55/bfb660548a6770238668c4b117d92f_thumb.jpg

database Stored in the database as a comma separated array like so for sort ordering.

ec1c55bfb660548a6770238668c4b117d92f,ec1c55bfb660548a6770238668c4b117d92f

Is this the most efficient way to do this? and is it scalable? I'm not sure if the photo hash is to large and I'm also not sure if the directory size is correct.

I created a more detailed post over on stackoverflow, just not sure where this question belongs. https://stackoverflow.com/questions/19106596/how-to-store-photo-on-file-system-and-store-sort-order-in-database

George
  • 145
  • 1
  • 8

1 Answers1

1

You should look into mogilefs. It was built with this exact problem in mind. http://www.mogilefs.org/

toppledwagon
  • 4,215
  • 24
  • 15