C# 使用C将html文件中的图像转换为base64#
我有一个html文件,我想用C#将它的图像从本地源转换成base64C# 使用C将html文件中的图像转换为base64#,c#,html,image,base64,C#,Html,Image,Base64,我有一个html文件,我想用C#将它的图像从本地源转换成base64 如果您能帮助我,我们将不胜感激。读取文件的字节,然后将其转换为base64: byte[] imageArray = System.IO.File.ReadAllBytes(@"image path"); string base64 = Convert.ToBase64String(imageArray); 如果文件不是本地文件,您需要。这有帮助吗?当我创建base64字符串时,我应该将其替换为图像路径?如何在html
如果您能帮助我,我们将不胜感激。读取文件的字节,然后将其转换为base64:
byte[] imageArray = System.IO.File.ReadAllBytes(@"image path");
string base64 = Convert.ToBase64String(imageArray);
如果文件不是本地文件,您需要。这有帮助吗?当我创建base64字符串时,我应该将其替换为图像路径?如何在html文件中找到图像路径?@请问另一个问题。
byte[] imageArray = System.IO.File.ReadAllBytes(@"image path");
string base64 = Convert.ToBase64String(imageArray);