ASP.NET保存之前调整大小?

时间:2012-12-29 16:58:24

标签: asp.net image file-upload

下面是我的代码,用于上传和映像并保存,以便稍后在GridView中显示,

如果图像太大,我怎样才能将图像调整为小图像然后保存?

if (this.fuUpload.HasFile == true)
        {
            string path = Server.MapPath(@"~\images");
            string filename = this.fuUpload.FileName;
            this.fuUpload.SaveAs(path + @"\" + filename);
            this.image.ImageUrl = @"\images\" + filename;
        }

2 个答案:

答案 0 :(得分:0)

看看ImageResizer for ASP.NET:

http://imageresizing.net/

答案 1 :(得分:0)

您可以使用System.Web.Helpers程序集中内置的WebImage 类。请查看Working with Images in an ASP.NET Web Pages指南。