?Image imgPhoto = Image.FromFile(ImgFile);??????????? Bitmap bmPhoto = new Bitmap(CutWidth, CutHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
??????????? Graphics gbmPhoto = Graphics.FromImage(bmPhoto);??????????? gbmPhoto.DrawImage(imgPhoto, new Rectangle(0, 0, CutWidth, CutHeight), PointX * imgPhoto.Width / PicWidth, PointY * imgPhoto.Height / PicHeight, CutWidth * imgPhoto.Width / PicWidth, CutHeight * imgPhoto.Height / PicHeight, GraphicsUnit.Pixel);??????????? gbmPhoto.Dispose();
???????????? if (!Directory.Exists(HttpContext.Current.Server.MapPath("/DZ/User/UserImages")))??????????? {??????????????? Directory.CreateDirectory(HttpContext.Current.Server.MapPath("/DZ/User/UserImages"));??????????? }??????????????? bmPhoto.Save(HttpContext.Current.Server.MapPath("/DZ/User/UserImages/"), System.Drawing.Imaging.ImageFormat.Jpeg);??????????????? imgPhoto.Dispose();??????????????? gbmPhoto.Dispose();??????????????? bmPhoto.Dispose();???????????System.Drawing.Image.Save 方法而導(dǎo)致 GDI+ 中發(fā)生一般性錯(cuò)誤 的發(fā)生,請(qǐng)各位打俠幫我看下,那代碼出問題了
2 回答

HUX布斯
TA貢獻(xiàn)1876條經(jīng)驗(yàn) 獲得超6個(gè)贊
HttpContext.Current.Server.MapPath("/DZ/User/UserImages/imgname.jpg")

侃侃無極
TA貢獻(xiàn)2051條經(jīng)驗(yàn) 獲得超10個(gè)贊
這是一個(gè)目錄,你需要提供一個(gè)文件名來保存。
bmPhoto.Save(HttpContext.Current.Server.MapPath("/DZ/User/UserImages/"), System.Drawing.Imaging.ImageFormat.Jpeg);
- 2 回答
- 0 關(guān)注
- 814 瀏覽
添加回答
舉報(bào)
0/150
提交
取消