这是我的代码:
protected void Resize(object sender, EventArgs e)
{
img3.Src = img1.Src;
img3.Width = Int32.Parse(imgWidth.Text);
img3.Height = Int32.Parse(imgHeight.Text);
String saveDir = "~/Images/rect/";
Image rimg = Image.FromFile(Server.MapPath(img3.Src));
Rectangle section = new Rectangle(new Point(0, 0), new Size(Int32.Parse(imgw.Value), Int32.Parse(imgh.Value)));
Bitmap b = new Bitmap(rimg, section.Size);
Graphics gr = Graphics.FromImage(b);
b.Save(Server.MapPath(saveDir + "rec" + DateTime.Now.ToString("ddMMyyyyhhmmss") + ".jpg"));
}
错误在这一行:
b.Save(Server.MapPath(saveDir + "rec" + DateTime.Now.ToString("ddMMyyyyhhmmss") + ".jpg"));
错误是:
`System.Runtime.InteropServices.ExternalException:一般错误 发生在GDI +。