ASP.NET中二进制流生成图片

public partial class SystemManage_ModulePicture : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
         if (!IsPostBack)
        {
           string strModuleID=Request.QueryString["ModuleID"].ToString();
            Module instance = new Module();
            byte[] imgData = instance.GetOneModule(strModuleID).IconFile;           //得到二进制图片数据

            if (imgData != null && imgData.Length != 0)
            {
                try
                {
                    System.IO.MemoryStream ms = new System.IO.MemoryStream(imgData);
                    System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
                    img.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);        //展现图片
                }
                catch
                {
 
                }
            }
        }
    }
}

 

posted @ 2013-06-18 09:04  Follow-your-heart  阅读(1054)  评论(0编辑  收藏  举报