Which option is better for storing image?

Discussion in 'HTML & Website Design' started by hirensoni913, Oct 25, 2010.

?

Where to save Image?

  1. Folder on server

    5 vote(s)
    71.4%
  2. Database

    1 vote(s)
    14.3%
  3. Both are same

    1 vote(s)
    14.3%
  4. Not sure

    0 vote(s)
    0.0%
  1. #1
    Can anybody suggest me which option is better to save image?

    We have 2 options:

    1. Save image in a folder on our server.
    2. Save image in database in binary format.

    why?
     
    hirensoni913, Oct 25, 2010 IP
  2. karthimx

    karthimx Prominent Member

    Messages:
    4,959
    Likes Received:
    127
    Best Answers:
    2
    Trophy Points:
    340
    #2
    can you tell me more about the purpose of storing and how much MB ?
     
    karthimx, Oct 25, 2010 IP
  3. hirensoni913

    hirensoni913 Peon

    Messages:
    79
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Purpose for saving image??? It could be anything. It could be saving members photo. products photo anything. And size we cant decide. One of my website is having more than 10gb Images.
     
    hirensoni913, Oct 25, 2010 IP
  4. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #4
    You save images in folders. Databases are for data.
     
    drhowarddrfine, Oct 25, 2010 IP
  5. ethikz

    ethikz Peon

    Messages:
    92
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    once again I concur with drhowarddrfine
     
    ethikz, Oct 25, 2010 IP
  6. hirensoni913

    hirensoni913 Peon

    Messages:
    79
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Even images are data. Otherwise why would all databases provide datatypes Image?
     
    hirensoni913, Oct 25, 2010 IP
  7. subdivisions

    subdivisions Well-Known Member

    Messages:
    1,021
    Likes Received:
    40
    Best Answers:
    1
    Trophy Points:
    145
    #7
    It doesn't matter. Serving images from a folder will be faster, but sometimes it's easier to store them in the db if you're running a huge site where images are user-contributed.
     
    subdivisions, Oct 25, 2010 IP
  8. andolasoft

    andolasoft Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    storing the images in the database will be a option because storing in server will take large amount of space and make it slower.
     
    andolasoft, Oct 28, 2010 IP
  9. ralphnsk

    ralphnsk Member

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #9
    File system only. With proper configuration it will only take one request to the HTTP server (which may be something lightweight like nginx or lighttpd) to retrieve an image. If you serve it from the database it takes one apache process, one php call, one call to mysql to say the least. HUGE waste of resources.
     
    ralphnsk, Oct 28, 2010 IP
  10. hirensoni913

    hirensoni913 Peon

    Messages:
    79
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    One thing I would like to inform you all. I did one simple test. In that I saved 5 images on server which occupied around 200 MB space while the same images on database occupied 40% less than storing it on server folder.
     
    hirensoni913, Oct 29, 2010 IP
  11. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #11
    The fact that that's impossible should give you pause to re-think that statement.
     
    drhowarddrfine, Oct 29, 2010 IP
  12. delmartin100

    delmartin100 Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Save image in a folder on our server.
     
    delmartin100, Oct 29, 2010 IP
  13. hackimos

    hackimos Greenhorn

    Messages:
    75
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    20
    #13
    image on folder is faster to load than a DB query
     
    hackimos, Oct 29, 2010 IP
  14. subdivisions

    subdivisions Well-Known Member

    Messages:
    1,021
    Likes Received:
    40
    Best Answers:
    1
    Trophy Points:
    145
    #14
    So I guess it boils down to speed vs disk space.
     
    subdivisions, Oct 29, 2010 IP