[Route("image/{fileName}")]
[Produces("text/plain or what???")]
public string image(string fileName)
{
byte[] b = fromsomewhere();
return "data:image/jpg;base64," + Convert.ToBase64String(b);
}
我应该在产品中添加什么?
我应该在响应中包含“data:image/png;base64”,还是应该在客户端上设置?!
我也考虑过使用
public dynamic image(string fileName)
{
byte[] b = fromsomewhere();
return new FileContentResult(b, "image/jpg");
}
这是一种更简单的方法和工作,但我仍然很有趣应该为 base64string 设置什么内容类型......