我使用以下方法将图像转换为 base64 字符串:
FileStream fs = new FileStream(imagePath, FileMode.Open,FileAccess.Read);
byte[] filebytes = new byte[fs.Length];
fs.Read(filebytes, 0, Convert.ToInt32(fs.Length));
return Convert.ToBase64String(filebytes, Base64FormattingOptions.InsertLineBreaks);
对于每个页面加载,此方法在运行时运行多次。我担心对我网站性能的影响。
我知道它会影响性能,但会显着影响它吗?