Home > OS >  How can I convert blob image from database to html image src
How can I convert blob image from database to html image src

Time:10-18

I have a blob field in the database which stores image blob. I want to convert this to an image in the html image src tag. How can this be done, i am using ASP.NET MVC c# as my backend.

CodePudding user response:

One way is to convert it to Base64String. First convert it to ByteArray then you can get Base64String. for example:

var imgUrl = $"data:{imageType};base64,{Convert.ToBase64String(buffer)}";
  • Related