...

View Full Version : Letting Users create their own "albums"



sfox8
07-25-2007, 04:43 AM
I'm making a website where people can upload their photos and I would like to allow users to create their own albums (and possibly limit it to only 5). I'm not sure how I would go about doing this. Could someone enlighten me? I'd really appreciate it.

whizard
07-25-2007, 06:04 PM
Make a table in a database to hold information about each photo,and another table to hold info about each user. In the image table, create a column 'user_id' to store the id of the user who uploaded the photo. Then, create an album script which retrieves all the photos tagged with a certain user id. (album.php?u=10 would retrieve all of user 10's photos).

If you want to limit the number of photos people can upload, make a column in the user table keeping track of how many photos the person has on the server, and be sure to update it every time they upload or delete a photo.

HTH
Dan

sfox8
07-26-2007, 02:16 AM
Make a table in a database to hold information about each photo,and another table to hold info about each user. In the image table, create a column 'user_id' to store the id of the user who uploaded the photo. Then, create an album script which retrieves all the photos tagged with a certain user id. (album.php?u=10 would retrieve all of user 10's photos).

If you want to limit the number of photos people can upload, make a column in the user table keeping track of how many photos the person has on the server, and be sure to update it every time they upload or delete a photo.

HTH
Dan

Thanks that helps with figuring out how to store the photos to a user, but I still need to know how to allow users to create multiple albums. Sorry I wasn't specific in the original post. Basically, I want them to be able to create an album (ex. "Sketches") and then they can upload their sketches to that album and then if they want a new album, I want to have it so that they can just create a new album for themself (ex. "Backgrounds"). Then that user will be able to upload pictures to his "sketches" album or his "backgrounds" album.

whizard
07-26-2007, 03:54 AM
ok, for each album, you create a row in the an 'albums' table. it holds the foreign id of the user who owns the album, and the foreign ids of the photos in the album. (as well as the album's name, id, and other stuff)

Then when you upload a picture, you have a dropdown box populated with all the albums owned by the current user.

HTH
Dan



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum