下面是一个加图片水印的问题,如果上传一张图片的时候一切正常,但是如果我循环多次的话,当上传到第3、4张的时候就会出错,GDI+ 中发生一般性错误。我把加水印的代码删掉后一切正常,请高手看看如何解决?谢谢了
string newPath4 = this.GetRandomint() +newFileName;
bitmap.Save(Server.MapPath("../upPic/") +newPath4, System.Drawing.Imaging.ImageFormat.Jpeg);
image.Dispose();
g.Dispose();
//加图片水印 
System.Drawing.Image image3 = System.Drawing.Image.FromFile(Server.MapPath("../upPic/")+newPath4); 
System.Drawing.Image copyImage = System.Drawing.Image.FromFile(Server.MapPath("../images/")+"pt.png"); 
Graphics gss = Graphics.FromImage(image3); 
gss.DrawImage(copyImage, new Rectangle(image3.Width-copyImage.Width, image3.Height-copyImage.Height, copyImage.Width, copyImage.Height), 0, 0, copyImage.Width, copyImage.Height, GraphicsUnit.Pixel); 
gss.Dispose(); 
string newPath1 = this.GetRandomint()+newFileName; 
image3.Save(Server.MapPath("../upPic/")+newPath1);
image3.Dispose();
if(File.Exists(Server.MapPath("../upPic/")+newPath4))
{
File.Delete(Server.MapPath("../upPic/")+newPath4);
}