首页 > 解决方案 > How can I convert blob image from database to html image src

问题描述

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.

标签: c#asp.net-mvcblob

解决方案


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)}";

推荐阅读