Open Xyroid opened 12 years ago
Storing media in the DB is not very good as the media can increase the size of the DB quite quickly. This may degrade performance. You can maybe try storing the media in a logical file structure. Such as:
Data
database.db
Images
People -- table
001.bmp -- <id>.bmp
002.bmp
Houses -- table
001.bmp
002.bmp
Audio
Cars -- table
001.mp3
002.mp3
But if you still want to use the DB:
http://www.codeproject.com/Articles/15460/C-Image-to-Byte-Array-and-Byte-Array-to-Image-Conv
In short:
public byte[] imageToByteArray(System.Drawing.Image imageIn)
{
MemoryStream ms = new MemoryStream();
imageIn.Save(ms,System.Drawing.Imaging.ImageFormat.Gif);
return ms.ToArray();
}
Serialization can be used to store custom media or objects as well.
I am developing an app which has some media files like images/audio/video clip. I want to insert those media files as datatype via SQLite in my C#/XAML windows store app. I can't find any example showing the blob datatype. How can I do that ?