Link Details

Link 876573 thumbnail
User 1071333 avatar

By phpfresher
Published: Nov 12 2012 / 09:28

This is the article about the way of storing images in mysql database using the blob column type in mysql. When dealing with a large amount of images, it is often useful to store them in a database. This makes accessing and changing the pictures easy and streamlined, even when you need to change more than one at once. One common task performed on stored images is to resize the image. Uploading and resizing an image using PHP and MySQL can be very simple, and it allows you to do many things, like create a batch of thumbnails for your image gallery, or just display a given image in a size other than the original. To begin, let us discuss about blob data type. It is a Binary Large Object. In short, a blob is a field type for storing Binary Data. Images are made up of binary data. This data cannot be stored in normal text fields in MySQL (such as text or varchar). Instead, we must use the blob type. MYSQL has four types of blobs:
  • 10
  • 1
  • 664
  • 375


Add your comment
User 763333 avatar

BrammarB replied ago:

0 votes Vote down Vote up Reply

This is a patently bad idea. Storing binary data in MySQL is slow as hell. Benchmarks here:

Add your comment

Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (10)

Voters Against This Link (1)

Apache Hadoop
Written by: Piotr Krewski
Featured Refcardz: Top Refcardz:
  1. Play
  2. Akka
  3. Design Patterns
  4. OO JS
  5. Cont. Delivery
  1. Play
  2. Java Performance
  3. Akka
  4. REST
  5. Java