how can we insert image file in mysql database?

1 view (last 30 days)
how can we insert image file in mysql database
  1 Comment
Cedric
Cedric on 24 May 2014
Edited: Cedric on 24 May 2014
I usually avoid storing images in DB, because it leads to unnecessary large tables. Instead, I save them in a specific folder in the file system, and I save their references only in the database.
To illustrate, if I need to process images and save the original, a thumbnail of the original, and the image after processing, I implement the following algorithm.
1. Receive/get image, save in temporary folder.
2. Add entry in database table of image references.
3. Get primary key of the latter.
4. Create folder with a name based on primary key, e.g. directly
with the primary key itself (1,2,..).
5. Move image from temp folder to folder just created.
6. Create thumbnail and save in same folder.
7. Process image and save processed version in same folder.
8. Optionally, set a flag in DB which indicates that processing went through.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 23 May 2014
There is a Database Toolbox product that you might want to look into.
  2 Comments
Image Analyst
Image Analyst on 24 May 2014
No, sorry, I don't have that toolbox. Check the help. Toolboxes always come with demos. Or view the examples online: http://www.mathworks.com/help/database/index.html

Sign in to comment.

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!