Forum Moderators: coopster

Message Too Old, No Replies

Image databasing / storing

         

smatts9

7:06 pm on Jul 19, 2006 (gmt 0)

10+ Year Member



I have a site, and I am going to put up an image upload script for my members. When saving images to the server would it be better to make separate directories such as:

site.com/images/ user's unique id / photoid.extension

or just

site.com/images/userid_photoid.ext

both would create unique filenames so I wouldn't have a problem there, but wondering which is faster and better?

Sekka

7:09 pm on Jul 19, 2006 (gmt 0)

10+ Year Member



Option 1 would be tidier for the server.

Option 2 would be easier to manage and maintain.

Either is good really in my opinion.

jatar_k

7:30 pm on Jul 19, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I honestly think option 1 is the best

stajer

7:48 pm on Jul 19, 2006 (gmt 0)

10+ Year Member



Consider scalability. If you site takes off, option 2 is easier to replicate and maintain across load balanced machines.

whoisgregg

4:07 pm on Jul 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is an overhead for an operating system to open/access a folder with lots of files (tens of thousands). For this reason alone, I would go with /user_id/photo_id.ext

jatar_k

6:53 pm on Jul 20, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> option 2 is easier to replicate and maintain across load balanced machines

how so?

hwhappy

8:55 am on Jul 21, 2006 (gmt 0)

10+ Year Member



I don't think there is any question really, option 1 is definately going to be the best, logically and physically, especially when the initial effort to do it that way isn't much.

There shouldn't really be an issue with speed that will be noticable, but I would say option 1 should allow for faster queries.

Cheers

Happy