string sExt = SourceImagePath.Substring(SourceImagePath.LastIndexOf(".")).ToLower(); if(SourceImagePath.ToString()==System.String.Empty) throw new NullReferenceException("SourceImagePath is null!"); if(!CheckValidExt(sExt)) { throw new ArgumentException("原图片文件格式不正确,支持的格式有[ "+ AllowExt +" ]","SourceImagePath"); } //从 原图片 创建 Image 对象 System.Drawing.Image image = System.Drawing.Image.FromFile(HttpContext.Current.Server.MapPath(SourceImagePath)); int num = ((ThumbnailImageWidth / 4) * 3); int width = image.Width; int height = image.Height; //计算图片的比例 if ((((double) width) / ((double) height)) >= 1.3333333333333333f) { num = ((height * ThumbnailImageWidth) / width); } else {页码:[1] [2] [3] [4] [5] [6] [7] [8] 第6页、共8页 |