当前位置: 代码迷 >> ASP.NET >> image.save 无法覆盖源文件解决思路
  详细解决方案

image.save 无法覆盖源文件解决思路

热度:5568   发布时间:2013-02-25 00:00:00.0
image.save 无法覆盖源文件
image.save 无法覆盖源文件,该如何操作?
谢谢

------解决方案--------------------------------------------------------
你可以试试这种方法

C# code
Image ReducedImage;using( System.IO.Stream stream = System.IO.File.OpenRead(resourceFile)){  ReducedImage = Image.FromStream(stream);  Image.GetThumbnailImageAbort callb = new Image.GetThumbnailImageAbort(ThumbnailCallback);  if ((ResourceImage.Width / ResourceImage.Height) >= 1)  {    ImageWidth = maxSize;    ImageHeight = (ResourceImage.Height) * ImageWidth / ResourceImage.Width;//等比例缩放  }  else  {    ImageHeight = maxSize;    ImageWidth = (ResourceImage.Width) * ImageHeight / ResourceImage.Height;//等比例缩放  }  ReducedImage = ResourceImage.GetThumbnailImage(ImageWidth, ImageHeight, callb, IntPtr.Zero);  ReducedImage.Save(targetFilePath, ImageFormat.Jpeg);  ReducedImage.Dispose();}  return true;
  相关解决方案