日期:2014-05-16  浏览次数:21069 次

.net WebForm读取显示图片本身
    图片以BJSON格式存在MongoDB中,取出转换为 System.Drawing.Image 类型,请问如何在页面上直接显示此图片而不是保存在本地再取路径赋值,WinForm中的PictureBox控件好像能直接赋值,但WebForm中好像没有类似的控件,各位大神请多多指教,小弟在此拜谢了
------解决方案--------------------
http://www.cnblogs.com/carekee/articles/2083426.html
------解决方案--------------------

你会那个图片验证码么?不会请去看图片验证码。然后你就懂他是怎么显示的了。。
------解决方案--------------------
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
            HttpContext.Current.Response.ClearContent();//Response.ClearContent();
            HttpContext.Current.Response.ContentType = "image/Jpeg";
            HttpContext.Current.Response.BinaryWrite(ms.ToArray());
            g.Dispose();
            image.Dispose();
------解决方案--------------------
<img src = "ImageShow.aspx?id=1" /> <img src = "ImageShow.aspx?id=2" /> 这不就是一个页面多个图片么?