Storing photos in file system

Discussion in 'PHP' started by NeoPhyte101, Mar 7, 2008.

  1. #1
    Hi guys,

    I'm currently creating a website with a user profile. I want to set it up so user's can upload a photo for their profile page. I was thinking the best way was to copy the photo to the root folder and link to the photo that way.

    Is there a way you can make it so the photo only appears a certain size(in other words to display small version of it) so as it fits a section perfectly


    Thanks for any help guys
     
    NeoPhyte101, Mar 7, 2008 IP
  2. mab

    mab Active Member

    Messages:
    563
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    80
    #2
    me too i want to know :)
     
    mab, Mar 7, 2008 IP
  3. sharqi

    sharqi Guest

    Messages:
    105
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can either
    use html tags <img src="foo.jpg" height="150" width="150" ?>
    This is the simplest way but the image is still the same filesize - its just resized. You can use php to evaluate if the image needs resizingif you want to keep the dimensions of the original image.

    or...
    resize the image with php - www.php.net/gd

    and....
    create a thumbnail with php - try http://phpthumb.sourceforge.net/

    also...
    Check : http://uk2.php.net/getimagesize
     
    sharqi, Mar 7, 2008 IP
  4. LittleJonSupportSite

    LittleJonSupportSite Peon

    Messages:
    386
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Personally I would store the images in a database as binary and call it out and re draw it by doing like:

    <img src="profile_img.php" width="150" height="150">

    Then you can just walk the table with session id to get your profile and info.

    or you could store the file location in mysql and look it up that way as well.

    Either way I would try and keep everything in one place, your system will thank you on the lack of overhead usage heh
     
    LittleJonSupportSite, Mar 7, 2008 IP
  5. mab

    mab Active Member

    Messages:
    563
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    80
    #5
    well i have an arcade site that allows users to resize the images ill take a look for the code :)
     
    mab, Mar 9, 2008 IP