News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sameer Borate:
Storing images into a database - resolving a contentious matter
February 21, 2013 @ 11:16:45

In this new post to his CodeDiesel site Sameer Borate looks at something that's been a controversial topic with developers (not just PHP) about storing binary data, like images, in a database instead of on the local file system.

There is much discussion and argument with no final say on the issue. In one of my recent project the same issue was raised; the client and myself discussing the benefits and drawback of storing the images into a database. The project needed storing around 50,000 images, so it was important to get the question resolved satisfactorily. After much deliberation we settled on using the file system. The major factor in the decision was that we needed the database and images decoupled as we would be having multiple databases using the same set of images.

He goes on to talk about some of the things you should consider when you're deciding if storing images in the database is the right thing for your application including:

  • The bloat that can come with storing binary data (larger database size)
  • Updating images requires two operations - updating the database and updating the cached image locally
  • Images usually serve faster when they come from the filesystem through the web server
  • BLOB (a common type for binary data storage) is variable-width and can degrade performance

You can read the rest of the reasons (and get more detail on the ones above) in the rest of the post.

0 comments voice your opinion now!
images binary data storage database benefits disadvantages


blog comments powered by Disqus

Similar Posts

PHPBuilder.com: Securing Data Sent Via GET Requests

PhPL33t Blog: How to Automated Plesk Email Creation

Lukas Smith\'s Blog: php|tek wrap up

Cody Caughlan's Blog: Database Migrations for PHP5

Sameer Borate: Storing images into a database - resolving a contentious matter


Community Events





Don't see your event here?
Let us know!


release symfony community podcast deployment series api opinion install tips package library voicesoftheelephpant introduction language framework bugfix list laravel interview

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework