SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Guru
    Join Date
    Mar 2002
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Should I upload images to mysql ? Bad idea?

    Hey, I have a project I am developing and I am getting feedback where i can on which method to use as I continue this...I can have users upload images and right now it saves to a mysql table

    If I get about 1000 daily visitors at most and at most 1000 images are stored in this db, will I be asking for trouble. Some say yes, some say mysql can handle this load

    What do you think?

    Or should I just have them moved to a folder on the domain and have the database point to them and load them without having to insert the actual image into mysql? What would you suggest?
    Thanks
    Last edited by jbh; Mar 4, 2002 at 14:43.

  2. #2
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The latter is, by far, the better solution. SitePoint Forums initially had the avatars saved into the actual MySQL database, but many problems arose. So it was modified so that the avatars are stored in a web folder and the database simply points to them. There's no more problems any longer.

    -Colin
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  3. #3
    SitePoint Guru
    Join Date
    Mar 2002
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I've been told that before, I was then told it's ok as mysql can handle the load...but didn't give a real live example to back it up

    I am starting to think I will have no choice but to
    move them to a folder on the website. Do you think since each separate user uploads their own photos I should just keep them all in one directory and attach the name + their id to it and poitn to it, or bother making separate folders? I am not keen on the idea of separate folders, I've just never had to do it this way...shouldn't be too difficult I guess

    Thanks, sorry for rambling

  4. #4
    SitePoint Guru
    Join Date
    Mar 2002
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ANywhere I can go to see the strain it would cause to mysql and how much it can handle if one uses the method to insert images?

  5. #5
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would store all of the images in a directory, as storing them in MySQL is very inefficient. Also, I would rename the image (say an avatar) to the user id when it is uploaded

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  6. #6
    SitePoint Guru
    Join Date
    Mar 2002
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am really leanging towards that idea, I just fear a problem will arise, even if I use longblob for the images...

    one article on zdnet supports images in db's, so many users say no...

    I guess I should just play it safe. So I should replace my insert code to insert the path instead of file itself, and convert the longblob field to text

    I guess that can't be so bad, and yes, the id is the right idea, I'd feel sick if I had overwritten images.


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
  •