insert Image into MS SQL Database

4 Ansichten (letzte 30 Tage)
feras
feras am 30 Apr. 2012
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!!

Akzeptierte Antwort

Geoff
Geoff am 1 Mai 2012
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!
  1 Kommentar
feras
feras am 4 Mai 2012
thnx Geoff i meant how to insert image into database but ur idea about save the unique name is better

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by