将用户上传的文件生成缩略图的方法
点击次数:27 次 发布日期:2008-11-26 14:25:37 作者:源代码网
|
具体给个例子就清楚啦。。 System.Web.HttpPostedFile UpFile = UpMhtFile.PostedFile; System.IO.FileStream myStream = new System.IO.FileStream(UpFile.FileName,System.IO.FileMode.Open,System.IO.FileAccess.Read); System.Drawing.Image.GetThumbnailImageAbort myCallback = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback); System.Drawing.Image img1 = System.Drawing.Image.FromStream(StreamObject); System.Drawing.Image timg = img1.GetThumbnailImage(100,100,myCallback,System.IntPtr.Zero); timg.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg); 源代码网供稿. |
