0
我想讓ImageResizer調整由WebAPI提供的圖像大小。我在文檔中安裝了ImageResizer。 /resizer.debug.ashx顯示沒有問題。當我嘗試調整靜態圖像的大小時,它工作正常。ImageResizer沒有調整由WebAPI提供的圖像大小
我試着用這些參數調整:
/api/files/image/image.jpg?width=100
/api/files/image/image.jpg?width=100&process=always
/api/files/image/image.jpg?width=100&format=jpg
我的WebAPI的行動看起來是這樣的:
[HttpGet]
public HttpResponseMessage Image(string name)
{
var filePath = GetFilePath();
var response = new HttpResponseMessage(HttpStatusCode.OK);
response.Content = new StreamContent(new FileStream(filePath, FileMode.Open, FileAccess.Read));
response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("inline");
response.Content.Headers.ContentDisposition.FileName = fileData.OriginalFileName;
response.Content.Headers.ContentLength = fileData.ContentLength;
response.Content.Headers.ContentType = new MediaTypeHeaderValue(fileData.MediaType);
return response;
}
是否有使用ImageResizer用的WebAPI的方法嗎?
謝謝!似乎我必須使用WebAPI來返回文件元數據並使用ImageResizer處理程序來提供圖像。而現在我的目的VirtualFolder插件將做我所需要的。 – marisks