二进制流生成图片

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 @ 2011-06-16 15:06  Rhythmk  阅读(2512)  评论(0编辑  收藏  举报
Rhythmk 个人笔记