public CropImage(ImageToCrop imageToCrop) { _x = imageToCrop.X; _y = imageToCrop.Y; _width = imageToCrop.Width; _height = imageToCrop.Height; _image = imageToCrop; }
public CropProfilePicture(ImageToCrop imageToCrop) { _image = imageToCrop.Image; _x = imageToCrop.X ; _y = imageToCrop.Y; _width = imageToCrop.Width; _height = imageToCrop.Height; }
public static ICropPicture GetCropType(string area, ImageToCrop image) { if (area.Contains("Users")) return new CropProfilePicture(image); else if (area.Contains("Pictures")) return new CropPetPicture(image); else return null; //switch (area) //{ // case "Users": // return new CropProfilePicture(image); // default: // return null; //} }
public string Crop(FormCollection formCollection) { var controller = HttpContext.Request.RequestContext.RouteData.DataTokens["area"].ToString(); var area = Request["area"]; var image = new ImageToCrop(); image.Image = Request.Files["file"]; image.X = int.Parse(Request["x"]); image.Y = int.Parse(Request["y"]); image.Width = int.Parse(Request["width"]); image.Height = int.Parse(Request["height"]); ICropPicture cropImage = CropPictureFactory.GetCropType(area, image); //var cropImage = new CropImage(image); cropImage.Crop(); return cropImage.ImageUrl; }
private void CropImage(ImageToCrop image, int x, int y, int w, int h, float zoom) { Bitmap mainImage = new Bitmap(image.Image.InputStream); }