![](/img/trans.png)
[英]How can i show an image from a database in mysql(blob), to an “Image” control in a web page
[英]How can I convert blob image from database to html image src
我在存储图像 blob 的数据库中有一个 blob 字段。 我想将其转换为 html 图像 src 标签中的图像。 如何做到这一点,我使用 ASP.NET MVC c# 作为我的后端。
一种方法是将其转换为 Base64String。 首先将其转换为ByteArray,然后您可以获得Base64String。 例如:
var imgUrl = $"data:{imageType};base64,{Convert.ToBase64String(buffer)}";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.