When I needed to know some basic information on BLOBs, I had very hard time finding it. Nearly every site I could not entirely understand at first glance. A BLOB is a “binary large object”; when using phpMyAdmin, you will see an upload form to insert a BLOB. Here is the maximum file sizes you can store in different blob fields in MySQL database.
|BLOB||65,536 Bytes||64 KB|
|MEDIUMBLOB||16,777,216 Bytes||16,384 KB||16 MB|
|LARGEBLOB||4,294,967,296 Bytes||4096 MB||4 GB|
Easy way to calculate exact sizes:
3 GB = 3 * 1024 * 1024 * 1024
4 MB = 4 * 1024 * 1024
2 KB = 2 * 1024
In many manuals for MySQL the limit is stated in characters, for BLOBs it is: 1 Character = 1 Byte
If you store a 2 MB picture in a MEDIUMBLOB and then change the field to BLOB, the picture will be cut off. Here is what you will get if you try opening teh image with gd library after fetching from database:
On the left is original uploaded or inserted image and on the right is what was actually stored from the inserted one and outputted with PHP GD library; using imagecreatefromstring() to make the image from the string fetched from the database.