简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM