1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP Upload & Mysql (ADVICE)

Discussion in 'PHP' started by xxxplatinium, Apr 22, 2012.

  1. #1
    Hello Fellas, I NEED SOME HELP
    I'm kina new in PHP and I'm here to sorta ask your opinion about something
    I'd like to do. Note: I'm not particulary asking for a php code or something,
    just a advice to know the best practice. So I want to build a photo upload
    form where users can upload multiple pictures, process the data received
    and save the images path into a mysql data table [?]. Then I will create a gallery
    when the user will retreive the images path and display them in this gallery.
    So it will be a photo album, and the gallery script will display a certain album.

    [?] First, How can i store multiple images paths in a single cell, is this possible?
    I mean when the user will upload the images these will be within a certain cell
    or group, so that only the pictures of a certain album are retreived and displayed.

    [?2] Second idea, what If I create a folder every single time a creates an album
    and uploads foto so something like: mysite/user/album/14/photos/ and then retreive
    the pictures directly via a simple php directory read script.

    Which of these ideas is better and why? Is there any other better idea, in terms of
    speed, server load etc. Please, I would highly appreciate your help.

    Thank you alot,
    Yours.
     
    xxxplatinium, Apr 22, 2012 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    What you want to do is store the meta-information (which album has which images, paths, groups, accesscontrol etc.) in the database, and the images themselves in separate folders.

    How advanced you wanna make it depends on you, but you could, for instance, make it possible for a user to create his/her own folders within their user-folder, and then chose which folder to upload images to when they upload. The images the gets stored in the folder they've chosen, thumbnails are automatically created, and the information about the images (comments, paths, etc.) are stored in the database.

    You put one image/information in each row. NEVER EVER store multiple values in one cell in a db-table - that's bad form, and will only lead to problems.
     
    PoPSiCLe, Apr 22, 2012 IP
  3. xxxplatinium

    xxxplatinium Active Member

    Messages:
    453
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    68
    #3
    Thank you for taking time to respond and for your advice.
    Highly appreciated,
    Thank you :)
     
    xxxplatinium, Apr 22, 2012 IP
  4. aliaydin

    aliaydin Greenhorn

    Messages:
    16
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    23
    #4
    popsicle is right. you should use a detail table for image informations related your main table.
     
    aliaydin, May 21, 2012 IP