insert Image into MS SQL Database
조회 수: 4 (최근 30일)
이전 댓글 표시
I have an axes control, i load an image into, then i need to get that image saved with other data , but i cant get the image to insert, what is the proper data type of the image?
any help please im stuck with that!!
댓글 수: 0
채택된 답변
Geoff
2012년 5월 1일
Your question confuses me a little. Do you modify the image using plots etc in the axis control, or is the whole mention of the axis control irrelevant to your question? Are you asking about saving the axis control data, or are you asking about storing the data itself in a database? I've answered your question in two different ways below. Hope it helps.
--
Are you asking how to save your axis control as an image?
You generally use the print command to save an image, but this requires the handle to a figure, not an axis.
doc print
If you don't have that then you need to work out how to fake it... This thread has one idea: http://www.mathworks.com/matlabcentral/newsreader/view_thread/88777
Alternatively, if you know the position of your axis control within your figure, you could print the whole figure to temporary file, then load that back in and crop it.
--
Are you asking how to store image data in a database?
You would normally use a BLOB to store images, but I've never done this. Not sure what conversion is necessary to put the data into a text query. So I can't answer this question directly.
Saying that...
In most of my readings on databases, people have tended to shy away from using BLOBS, opting instead to reference data outside the database. That means you generate a unique file name for your image, store it to disk, and put the file name into your table.
I have used this approach many times for various databases and I like it. It's simple and avoids database design complications that arise when dealing with BLOBS (so I've heard). Why get yourself into a potential pickle when a simple alternative exists? =)
I'm not a purist - it only took a small amount of industry experience to beat that out of me. So I have no problem decoupling some data from my database for the sake of protecting my sanity. Maybe you are a purist, or you are forced to store the image in your database. In that case I apologise for being no help whatsoever!
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Database Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!