SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Jul 2007
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Uploading Profile Images - Questions

    I have a few questions. I am building a small "facebook" in it's most basic form. I am getting very good at the text portion and making a nice usable site, but I've never tried to store images before and this media part of it is very new to me. Right now my goal is to have a user upload just one profile image.

    Is it best to store the images in the database itself or do I store them in some directory such as "www.mysite.com/imagefolder"? What way is better in the long run scheme when I get millions of members?

    I've been hearing that storing the photos in a directory may be the best way to go (not entirely sure yet). If this is the case, can someone show me to a very basic tutorial or provide some code just for uploading a single user profile image as well as the MySQL code for the database portion?

    Currently, I have all my users and their info running on a single table inside my database. I assume it would be simpler to add this extra "profile image" column onto this table rather than creating a whole separate table for this?


    Thanks
    Best

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The database is not optimized for storing large amounts of binary data, the filesystem is. Especially when you have to scale it. Keep the images as normal files, and store just the filename in the database.

  3. #3
    SitePoint Addict
    Join Date
    Jul 2007
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome, thanks for the help Dan. I will definitely be using the file system from now on.

    Well, I did figure out how to give users the option to upload their profile picture and make default pictures for new members and ect.

    But I will ask about building whole picture galleries some other time, my next challenge.

    Thanks
    Best


Bookmarks

Posting Permissions

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