Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Letting Users create their own "albums"

    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.

  • #2
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    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
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #3
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by whizard View Post
    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.

  • #4
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    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
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •