insert Image into MS SQL Database
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Geoff
le 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!
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Database Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!