Reputation: 401
The best way to store images into MySQL is by storing the image location as a character string.
If you need to manipulate the image, then, the best way is to copy the image as a binary.
How one can store images into binary form and how we can retrieve them back? I don’t know anything about this technique. Please tell me how we can do this.
Upvotes: 0
Views: 2840
Reputation: 89202
I've written some blogs on this (and have some data from SQL Server)
http://www.atalasoft.com/cs/blogs/loufranco/archive/2009/10/26/more-on-images-in-databases.aspx
Basically,
Almost every professional enterprise system that needs to deal with a lot of large blobs has some way of putting them on the filesystem. The latest SQL Server even has a field type that will do it automatically (and then it's as easy to program and manage as a blob)
Upvotes: 1
Reputation: 38513
You can use the BLOB data type. Although I agree with @Ignacio Vazquez-Abrams, there are times where storing the image in the DB is best. I have done so in past with great results. As long as the files are not large then this is a good solution.
Upvotes: 0
Reputation: 798884
Don't store images in the database. Store them in the filesystem, then store their relative paths in the database.
Upvotes: 6