Page 1 of 1

Storing reference to images in database?

Posted: Tue Nov 23, 2004 5:26 pm
by bradles
Hi All,

I have a script for my image gallery that retrieves an array of image names from a folder. Are there any advantages of having these names of images listed in the database?

Am I better to run my script based on what is stored in a database or should I just retrieve the list from the folder and then store the array in a session variable?

Brad.

Posted: Tue Nov 23, 2004 5:52 pm
by John Cartwright
Personally I like to keep everything stored in a database. Just so I can much more easily manipulate it's data. For instance I only want to get photos inserted from a specific date on. Cannot do that dynamically grabbing your info by checking the folder. This is only one advantage out of many :P

I would say database.

Posted: Tue Nov 23, 2004 6:00 pm
by bradles
Thanks Phenom,

I looked at phpwebgallery and noticed that in their script they upload the images into a folder but they also run a process which stores all the names in the database. As I'm still wrapping my head around PHP, I didn't know if I should be doing the same thing or not. I think I will try and store them in a database though...it might be good practise.

Brad.

Posted: Tue Nov 23, 2004 6:24 pm
by John Cartwright
Well it all depends on the scalability you are looking for grabbing the files from the folder. If you want something simple and dont want to involve the database, then why not, there is nothing wrong witth not using a database.