public ActionResult Crop(int id, string path) { var image = new WebImage(_PATH + path); ImageModel imageModel = new ImageModel() { ImagePath = path, Height = image.Height, Width = image.Width, Top = Convert.ToInt32(image.Height * 0.1), Left = Convert.ToInt32(image.Width * 0.1), Right = Convert.ToInt32(image.Width * 0.9), Bottom = Convert.ToInt32(image.Height * 0.9) }; return View(imageModel); }
public ActionResult Crop(ImageModel imageModel) { WebImage image = new WebImage(_PATH + imageModel.ImagePath); var height = image.Height; var width = image.Width; var top = imageModel.Top; var left = imageModel.Left; var bottom = imageModel.Bottom; var right = imageModel.Right; image.Crop(top, left, height - bottom, width - right); image.Resize(140, 200, false, false); image.Save(_PATH + imageModel.ImagePath); return RedirectToAction("Index"); }