Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What data type to use in MySQL to store images?

Tags:

mysql

I need to store image and resume of user in the data base.

I am using mysql data base and php5. I need to know which data types I should use.

And also how do I set a limit (maximum size) for uploaded data.

like image 799
rajson Avatar asked Mar 19 '10 04:03

rajson


People also ask

What is the data type for image in database?

To insert images into a database, the database must support images. Images are stored in binary in a table cell. The data type for the cell is a binary large object (BLOB), which is a new SQL type in SQL3 for storing binary data.

Which datatype is used to store images SQL Server?

The IMAGE data type in SQL Server has been used to store the image files. Recently, Microsoft began suggesting using VARBINARY(MAX) instead of IMAGE for storing a large amount of data in a single column since IMAGE will be retired in a future version of MS SQL Server.

Can MySQL store images and videos?

In MySQL you can store any binary content in a table using the BINARY or VARBINARY data type for a column. Quite all database system as such a data type. It can be used to store a full file content such as picture, video, sound,... or just a binary snippet.


2 Answers

What you need, according to your comments, is a 'BLOB' (Binary Large OBject) for both image and resume.

like image 58
lexu Avatar answered Oct 05 '22 03:10

lexu


Perfect answer for your question can be found on MYSQL site itself.refer their manual(without using PHP)

http://forums.mysql.com/read.php?20,17671,27914

According to them use LONGBLOB datatype. with that you can only store images less than 1MB only by default,although it can be changed by editing server config file.i would also recommend using MySQL workBench for ease of database management

like image 39
Nidhin David Avatar answered Oct 05 '22 02:10

Nidhin David