Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Picture's in the database?

Picture's in the database?

Scheduled Pinned Locked Moved Database
asp-netquestioncsharpdatabasearchitecture
10 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    David C Hobbyist
    wrote on last edited by
    #1

    I just spent 2 hours googleing best practices for storing picture's for a asp.net MVC project that I am starting. There are two school's of thought. One is to store the Picture's in a database (for ease of backup's) Another is to use the site's file system. (For speed) This project will be for my family.(Very Large Family I might add) I want to keep Pictures Referenced to the user that uploaded them. And only share some of them with other member's My question: What do You think about storing the file's in the database? And why? Thanks in advance Any good resources or link's appreciated

    Frazzle the name say's it all

    M P P W 4 Replies Last reply
    0
    • D David C Hobbyist

      I just spent 2 hours googleing best practices for storing picture's for a asp.net MVC project that I am starting. There are two school's of thought. One is to store the Picture's in a database (for ease of backup's) Another is to use the site's file system. (For speed) This project will be for my family.(Very Large Family I might add) I want to keep Pictures Referenced to the user that uploaded them. And only share some of them with other member's My question: What do You think about storing the file's in the database? And why? Thanks in advance Any good resources or link's appreciated

      Frazzle the name say's it all

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      I use the file system but then I have 1000s of images, the economy of backing up the database and moving it to my dev environment alone dictates that I do not want the image files inside that backup. What do I care if the images are trashed on the server, I have less timely backups of them elsewhere, I certainly don't want to move them over the wire every time I take a backup of my data.

      Never underestimate the power of human stupidity RAH

      D 1 Reply Last reply
      0
      • D David C Hobbyist

        I just spent 2 hours googleing best practices for storing picture's for a asp.net MVC project that I am starting. There are two school's of thought. One is to store the Picture's in a database (for ease of backup's) Another is to use the site's file system. (For speed) This project will be for my family.(Very Large Family I might add) I want to keep Pictures Referenced to the user that uploaded them. And only share some of them with other member's My question: What do You think about storing the file's in the database? And why? Thanks in advance Any good resources or link's appreciated

        Frazzle the name say's it all

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        I put them in the database, they're safer there. In the file system, someone may overwrite* or delete a file. I don't backup my databases though. :~ * Replace your favorite shot of Granny with a picture from your cousin's bachelor party (or vice versa).

        D 1 Reply Last reply
        0
        • P PIEBALDconsult

          I put them in the database, they're safer there. In the file system, someone may overwrite* or delete a file. I don't backup my databases though. :~ * Replace your favorite shot of Granny with a picture from your cousin's bachelor party (or vice versa).

          D Offline
          D Offline
          David C Hobbyist
          wrote on last edited by
          #4

          PIEBALDconsult wrote:

          * Replace your favorite shot of Granny with a picture from your cousin's bachelor party (or vice versa).

          as I am almost a grandfather This would make me Upset!!! Thank You for the reply I will consider this issue when I Finally :) decide which way to go

          Frazzle the name say's it all

          1 Reply Last reply
          0
          • M Mycroft Holmes

            I use the file system but then I have 1000s of images, the economy of backing up the database and moving it to my dev environment alone dictates that I do not want the image files inside that backup. What do I care if the images are trashed on the server, I have less timely backups of them elsewhere, I certainly don't want to move them over the wire every time I take a backup of my data.

            Never underestimate the power of human stupidity RAH

            D Offline
            D Offline
            David C Hobbyist
            wrote on last edited by
            #5

            Mycroft Holmes wrote:

            I certainly don't want to move them over the wire every time I take a backup of my data.

            That is a good point I don't think I will have that many images but you never know at design time If the project will be a hit with the User's.

            Frazzle the name say's it all

            1 Reply Last reply
            0
            • D David C Hobbyist

              I just spent 2 hours googleing best practices for storing picture's for a asp.net MVC project that I am starting. There are two school's of thought. One is to store the Picture's in a database (for ease of backup's) Another is to use the site's file system. (For speed) This project will be for my family.(Very Large Family I might add) I want to keep Pictures Referenced to the user that uploaded them. And only share some of them with other member's My question: What do You think about storing the file's in the database? And why? Thanks in advance Any good resources or link's appreciated

              Frazzle the name say's it all

              P Offline
              P Offline
              Pradeep Shukla 0
              wrote on last edited by
              #6

              There are few questions that you should have answer to make this decision: File System: - Images sizes are smaller than 2 MB. - No editing required on the images in future - Faster access Database: - Image size is on a higher side 2+ MB. - Easy maintenance and backup required There is an another approach of FILESTREAM if you are planning to use sql server 2008. http://msdn.microsoft.com/en-us/library/cc716724.aspx[^] hope it helps.

              1 Reply Last reply
              0
              • D David C Hobbyist

                I just spent 2 hours googleing best practices for storing picture's for a asp.net MVC project that I am starting. There are two school's of thought. One is to store the Picture's in a database (for ease of backup's) Another is to use the site's file system. (For speed) This project will be for my family.(Very Large Family I might add) I want to keep Pictures Referenced to the user that uploaded them. And only share some of them with other member's My question: What do You think about storing the file's in the database? And why? Thanks in advance Any good resources or link's appreciated

                Frazzle the name say's it all

                W Offline
                W Offline
                Wendelius
                wrote on last edited by
                #7

                Here's an short article I wrote some tome ago concerning binary data in the database. Perhaps it would be of some help: How to store and fetch binary data into a file stream column[^]

                The need to optimize rises from a bad design.My articles[^]

                D 1 Reply Last reply
                0
                • W Wendelius

                  Here's an short article I wrote some tome ago concerning binary data in the database. Perhaps it would be of some help: How to store and fetch binary data into a file stream column[^]

                  The need to optimize rises from a bad design.My articles[^]

                  D Offline
                  D Offline
                  David C Hobbyist
                  wrote on last edited by
                  #8

                  I just read your article. Interesting so basically all that gets stored in the database is a GUID and correct me if I'm wrong a Hash of the file size? And the file itself goes in the file system? I don't see the benefit in storing the info 2 times. Other than maybe so it can be strongly typed. Maybe I missed the Point I will reread the article

                  Frazzle the name say's it all

                  W 1 Reply Last reply
                  0
                  • D David C Hobbyist

                    I just read your article. Interesting so basically all that gets stored in the database is a GUID and correct me if I'm wrong a Hash of the file size? And the file itself goes in the file system? I don't see the benefit in storing the info 2 times. Other than maybe so it can be strongly typed. Maybe I missed the Point I will reread the article

                    Frazzle the name say's it all

                    W Offline
                    W Offline
                    Wendelius
                    wrote on last edited by
                    #9

                    One of the main points is the transactionality. In case of an error you don't have to worry if the database contains a path to a non existent file or vice versa. Second thing, backups. When you backup the database you also backup the files. No separate backups. Thirdly, speed with larger files compared to storing all the binary info inside the database. And the fourth thing, which I haven't covered very much yet is that you can actually stream the file better to the client when fetching. I think those would be the main points. All comments are very welcome :)

                    The need to optimize rises from a bad design.My articles[^]

                    D 1 Reply Last reply
                    0
                    • W Wendelius

                      One of the main points is the transactionality. In case of an error you don't have to worry if the database contains a path to a non existent file or vice versa. Second thing, backups. When you backup the database you also backup the files. No separate backups. Thirdly, speed with larger files compared to storing all the binary info inside the database. And the fourth thing, which I haven't covered very much yet is that you can actually stream the file better to the client when fetching. I think those would be the main points. All comments are very welcome :)

                      The need to optimize rises from a bad design.My articles[^]

                      D Offline
                      D Offline
                      David C Hobbyist
                      wrote on last edited by
                      #10

                      Mika Wendelius wrote:

                      One of the main points is the transactionality. In case of an error you don't have to worry if the database contains a path to a non existent file or vice versa.

                      So it wil be Strongly Typed" This I like! :)

                      Mika Wendelius wrote:

                      Second thing, backups. When you backup the database you also backup the files. No separate backups.

                      This I like Alot! :)

                      Mika Wendelius wrote:

                      Thirdly, speed with larger files compared to storing all the binary info inside the database.

                      This should not be a problem, because I Intend to re-size the Images.

                      Mika Wendelius wrote:

                      And the fourth thing, which I haven't covered very much yet is that you can actually stream the file better to the client when fetching.

                      This on the other hand I Love. But I will have to learn a bit more about. Looks like Google time! :)

                      Frazzle the name say's it all

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups