php_beginner_83 Posted May 12, 2009 Share Posted May 12, 2009 Hi All I'm currently trying to develop a database driven photo gallery. So far I have it working and displaying images no problem. The next step I want to take is to create seperate photo albums, e.g an album with my Christmas photos, another for holiday photos etc. The idea I had was in the table in my database to include 2 additional fields, one to record the name of the album the photo belongs to and another to indicate whether that picture is the cover photo of the album. Then I could use a MySQL query to get all the photos that belong to the albums and get the cover picture. On my webpage, I would like to display the cover picture with the name of the album beneath it and when the user clicks the name of the album, a page will open displaying the contents of the selected album. I would like your opinion of my way of thinking. Do you think it is a good way to do this or do you have a more simple idea. I would really appreciate any advice you have to give. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/157879-advice-on-creating-albums-within-a-mysql-database-photo-gallery/ Share on other sites More sharing options...
xtopolis Posted May 13, 2009 Share Posted May 13, 2009 I think it would be better to keep the table of photos separate rather than add 2 columns with album and isAlbumCoverPhoto type of column. You could perhaps add just one column, albumID FK (int). Then create a table "albums" which has a auto increment "albumID" PK (int), albumName (varchar?), coverPhoto FK (int). I don't think it'd be wise to create a column such as "isalbumcoverphoto" on the photos table because you will basically have NOs for all but the # of albums that exist - a waste of space and irrelevant to the photo itself. Looking forward however, you may create another separate table including the "photoID, albumID" so that photos can exist in multiple albums. This example would have 3 tables: photos, photos-albums, albums. Quote Link to comment https://forums.phpfreaks.com/topic/157879-advice-on-creating-albums-within-a-mysql-database-photo-gallery/#findComment-832954 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.