I have an MVC Application that uses Entity Framework to comunicate with database.
I want to get an image that is saved in the DB and load it on screen, but I can't figure out the way to do this.
Thanks in advance.
Pedro
I have an MVC Application that uses Entity Framework to comunicate with database.
I want to get an image that is saved in the DB and load it on screen, but I can't figure out the way to do this.
Thanks in advance.
Pedro
You probably save the image in the database with a byte array, then you must use System.Drawing.Image class to convert the byte array that came from the DB.
Consider "imageFromDb" as the array from the database.
using (System.Drawing.Image image = System.Drawing.Image.FromStream(new MemoryStream(imageFromDb)))
{
// Do the job that you want with the image.
}
Wish you Luck :)