如何使用asp web api返回多个图像,然后设置angularjs来显示它们?我一直在寻找一点,但我没有得到任何工作。我真的被困在这里,所以任何帮助将不胜感激!
我当前的代码:列出图像;使用 (var uow = new UnitOfWork()) { images = uow.ImageMetadatas.Query(m => m.AlbumId == albumId).Select(m => m.Filename).ToList(); }
var content = new MultipartContent();
foreach (var img in images)
{
var image = new Bitmap(img);
var thumbnail = image.GetThumbnailImage(200, 200, ThumbnailCallback, IntPtr.Zero);
var stream = new MemoryStream();
thumbnail.Save(stream, ImageFormat.Jpeg);
var imgContent = new StreamContent(stream);
imgContent.Headers.ContentType = MediaTypeHeaderValue.Parse("image/jpeg");
content.Add(imgContent);
}
return new HttpResponseMessage(HttpStatusCode.Accepted) { Content = content };