博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MVC4 WebAPI中如何返回一张图片
阅读量:4592 次
发布时间:2019-06-09

本文共 537 字,大约阅读时间需要 1 分钟。

public HttpResponseMessage Get(string imageName, int width, int height)    {        Image img = GetImage(imageName, width, height);        MemoryStream ms = new MemoryStream();        img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);        HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);        result.Content = new ByteArrayContent(ms.ToArray());        result.Content.Headers.ContentType = new MediaTypeHeaderValue("image/png");        return result;    }

转载于:https://www.cnblogs.com/gzalrj/p/3992321.html

你可能感兴趣的文章
getopt()函数
查看>>
第八届极客大挑战 Re
查看>>
ZOJ3471--Most Powerful(状压DP)
查看>>
POJ3666-Making the Grade(左偏树 or DP)
查看>>
杭电2084数塔
查看>>
ISE中FPGA的实现流程
查看>>
虚拟机centos笔记整理,持续更新~~
查看>>
Spring MVC访问静态资源
查看>>
jquery实现的个性网站首页 详细信息
查看>>
poj2096 Collecting Bugs
查看>>
【机器学习】关联规则挖掘(二):频繁模式树FP-growth
查看>>
MD5加密
查看>>
关于R软件的安装
查看>>
小程序上传图片
查看>>
1-1000的所有的完数
查看>>
Sharepoint
查看>>
bootstrap treeview 树形数据生成
查看>>
C++ Primer 读书笔记整理(一)
查看>>
[SAP FI-AP]自動支払(tr-cd:F110)に関係するテーブル
查看>>
Visual Studio 2013 中 mysql 使用 EF6
查看>>