MVC的图像处理程序 [英] image handler on mvc
本文介绍了MVC的图像处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个图像处理器,将调整和服务于图片到我的应用程序,
我如何调用处理程序上的MVC?
i want to create an image handler that will resize and serve images to my application, how do i call the handler on mvc?
推荐答案
您将使用返回 FileStreamResult
在你的操作方法,而不是一个处理程序。
You would use return a FileStreamResult
in your action method instead of a handler.
public ActionResult GetFile()
{
using (FileStream stream = new FileStream())
{
FileStreamResult result = new FileStreamResult(stream, "image/jpg");
result.FileDownloadName = "image.jpg";
return result;
}
}
您可以实现在操作一些调整的逻辑。
You could implement some resizing logic in the action.
这篇关于MVC的图像处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文