MemoryStream stream1 = new MemoryStream((byte[])detail.Image);//取图片数据流,你自己读文件先.
System.Drawing.Image tempimg = System.Drawing.Image.FromStream(stream1);//转成图片类
System.Drawing.Image myThumbnail = tempimg.GetThumbnailImage(width,height,null, IntPtr.Zero);//缩略,width,height你自己要定义好大小
myThumbnail.Save(Response.OutputStream,tempimg.RawFormat);//显示
System.Drawing.Image tempimg = System.Drawing.Image.FromStream(stream1);//转成图片类
System.Drawing.Image myThumbnail = tempimg.GetThumbnailImage(width,height,null, IntPtr.Zero);//缩略,width,height你自己要定义好大小
myThumbnail.Save(Response.OutputStream,tempimg.RawFormat);//显示
博客介绍了在.NET环境下,将图片数据流转换为缩略图并显示的操作。通过MemoryStream获取图片数据流,将其转换为图片类,再生成指定大小的缩略图,最后将缩略图保存到输出流进行显示。
2801

被折叠的 条评论
为什么被折叠?



