当前位置:编程学习 > C#/ASP.NET >>

截取图片提示内存不足,本地测试没问题,线上自己机器打开也没问题,可别人的提示内存不足?

本地测试没问题,线上自己机器打开也没问题,可别人的提示内存不足,搞不懂啊?

 //获得选择的图片大小,并截图
  int x1 = Int32.Parse(Request.Params["x1"]);
  int y1 = Int32.Parse(Request.Params["y1"]);
  int x2 = Int32.Parse(Request.Params["x2"]);
  int y2 = Int32.Parse(Request.Params["y2"]);
  string pathOld = this.opic.ImageUrl;
  Bitmap bmp = new Bitmap(Server.MapPath(pathOld));
  Rectangle cloneRect = cloneRect = new Rectangle(x1, y1, x2 - x1, y2 - y1);
  if (bmp.Width > 400)
  {
  double scaleRate = (bmp.Width + 0.0) / 400;
  int newx1 = Convert.ToInt32(Math.Round(x1 * scaleRate));
  int newy1 = Convert.ToInt32(Math.Round(y1 * scaleRate));
  int newx2 = Convert.ToInt32(Math.Round(x2 * scaleRate));
  int newy2 = Convert.ToInt32(Math.Round(y2 * scaleRate));
  cloneRect = new Rectangle(newx1, newy1, newx2 - newx1, newy2 - newy1);
  }
  Bitmap colneBitMap = bmp.Clone(cloneRect, bmp.PixelFormat);//提示这一步有问题,内存不足,请大侠们看看
  //确定图片添加图片路径
  string path = "";
  if (Request.QueryString["ConsultID"] != null && Request.QueryString["ConsultID"] != "")
  {
  path = "../user_pic/Consult" + Request.QueryString["ConsultID"].ToString() + ".jpg";
  }
  else
  {
  path = "../user_pic/Consult" + getNewConsultID() + ".jpg";
  }
  colneBitMap.Save(Server.MapPath(path));
  bmp.Dispose();
  colneBitMap.Dispose(); --------------------编程问答-------------------- 都知道内存不足了...... --------------------编程问答--------------------
引用 1 楼 soloboy1020 的回复:
都知道内存不足了......

能不能说具体点? --------------------编程问答-------------------- 他用的是平板电脑么???(你可以在自己机器上看一下!~ 操作的时候要用多少内存啊~~)
 
或者他的图片是不是太大了??????
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,