Search code examples
phpphoto-gallerypicturegallery

Help me deal with the logic behind picture gallery


Using PHP i want to create a picture gallery, i need a few suggestion on what would be the best logical solution for this.

a) create a directory for an album and move all the related pictures into the directory and henceforth follow the same way for other albums

b) keep a record or the path using the database(MySQL) and use the relational table (album).

for the method a . is there any way to deal the picture gallery without actually having the need to use the database or XML or whatsoever(database).?

what is your take on this? thank you.


Solution

  • IMO the database route is the one to take, as it will be much more extensible and easier to maintain.

    If you decide to add in a rating/description/review/[whatever] at a later date you will have the foundations in place.

    you can still create a directory for each album - WordPress adopts this kind of practice (/uploads/2010/10) for instance - (directories for each month)

    you could do it without a database, through some means of directory traversal and an imaginative naming scheme - if you wanted to sort or search the images some common naming format would be needed. Plus you are very restricted on meta data.

    +1 for database from me. You ~can~ even store the images in the DB. but I prefer to keep them as images and just link to the path.

    my $0.02