I'm here to ask for advice rather than ask for code critique. I read the rules and I am not posting code, so forgive me if I am asking in the wrong place; I just didn't know which forum would be the most appropriate.
Here's the scenario. The "client" wants a PHP script that serves as an image gallery. He will upload the images via FTP to a certain location and the script will generate thumbnails. The images will be sorted into subfolders ("albums") in the gallery folder with a structure as deep and flexible as he needs. He also wants an interface that can be used to append titles and descriptions to images and albums. Lastly, he wants a system to be used by his site guests to rate and comment on images and galleries.
Basically, in terms of resources, do you think it would be more logical to use a flat-file system to store the information or a database structure? Obviously, using a database is cleaner because all of the information is clearly stored in one place. But, correct me if I'm wrong, but querying a database is heavier on server resources than, say, reading an XML or CSV file.
Let's say that the client has 2000 images. If I store the data for his images in a CSV file like so:
"path/to/image.jpg", "Title 1", "Description 1"
"path/to/other/image.gif", "Title 2", "Description 2"
Will it take a lot of server effort to convert this CSV file into an array and then search that array for the image that I need to recall the title and description from?
And my bigger concern is a master file that contains comments, e.g.
"Commenter", "http://www.commenters-url.com/", "{timestamp}", "Comment goes here.", "path/to/image.jpg"
This file would likely have a lot LOT of comments.
Basically, through the million words I just used to ask this simple question, I am trying to get at this: is querying a database table with thousands of rows to locate, say, all of the comments associated with an image in the "image" field of the table as much of a load on server resources as running through a massive array in search of data? If I use MySQL, do I have to develop a caching system or something?