C#将图片字节流转为Base64直接放入html的img标签src属性中

原地址:http://www.cnblogs.com/RedSky/p/5786703.html点击打开链接

1,图片要转为byte[],

2,注意加上“data:image/jpeg;base64,”,这里jpeg可以换成其他。

string html = "<img src='https://img-blog.csdnimg.cn/2022012009112513475.jpeg"margin:0px; padding:0px; color:rgb(128,0,0); line-height:1.5!important">" + Convert.ToBase64String(byte[] bytes) + "' />";
    原文作者:叫我梧桐树
    原文地址: https://blog.csdn.net/u012732371/article/details/54971272
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞