Asp.net mvc 从数据库中获取图像数据类型,并在需要打印时显示
我从SQL数据库中获取一个图像。控制器中的代码是Asp.net mvc 从数据库中获取图像数据类型,并在需要打印时显示,asp.net-mvc,angularjs-directive,Asp.net Mvc,Angularjs Directive,我从SQL数据库中获取一个图像。控制器中的代码是 public ActionResult RetrieveImage(Guid id) { byte[] cover = GetImageFromDataBase(id); if (cover != null) { return new FileContentResult(cover, "image/jpeg"); } else
public ActionResult RetrieveImage(Guid id)
{
byte[] cover = GetImageFromDataBase(id);
if (cover != null)
{
return new FileContentResult(cover, "image/jpeg");
}
else
{
return null;
}
}
public byte[] GetImageFromDataBase(Guid id)
{
//UserProfile aUser = new UserProfile();
Chamber aChamber = new Chamber();
aChamber = chamberService.GetChamber(id); // From here i got the image as a datatype[] base64 value
byte[] cover = aChamber.Logo;
return cover;
}
我的查看页面(在这里我可以显示此图像)是
您将什么元素传递到
PrintElem
函数中?如果将img
放入其中,$(elem).html()
将返回空字符串。我传递html元素,,,对于图像打印,我传递图像,但这不是问题,因为如果我从应用程序中的任何物理位置传递默认pic,它将显示在打印页面中,,,但在这里我传递字节[]64位数据,,,,,当我这样做时,它会显示为空,,,,,
<img ng-src='/Chamber/RetrieveImage/{{chamberDoctorId.Id}}' id="photo-id-edit" height=20 width=200 style="border:2px solid black" />
only the boarder of the image are found,,but it can't show the image,,,how can i show my image in my print page,,why it isn't show in there??