Data Type for Images in Laravel

Viewed 9819

I'm currently using the binary data type for images.

$table->binary('image');

An error gets raised when I try to save an image which is more than 64kb in size.

#1366 - Incorrect integer value: '' for column 'pet_owner_id' at row 1.

In MySQL that data type is shown as blob.

1 Answers

Datatype for image $table->binary('image'); //for blob

Storing binary data Binary data, such as images, bloat your tables and cannot be displayed directly from a database, the following column types are designed for binary data:

  • TINYBLOB: Up to 255 bytes
  • BLOB: Up to 64KB
  • MEDIUMBLOB: Up to 16MB
  • LONGBLOB: Up to 4 GB

BLOB stands for binary large object

Related