예제 #1
0
 public CropImage(ImageToCrop imageToCrop)
 {
     _x = imageToCrop.X;
     _y = imageToCrop.Y;
     _width = imageToCrop.Width;
     _height = imageToCrop.Height;
     _image = imageToCrop;
 }
예제 #2
0
 public CropProfilePicture(ImageToCrop imageToCrop)
 {
     _image = imageToCrop.Image;
         _x = imageToCrop.X ;
         _y = imageToCrop.Y;
     _width = imageToCrop.Width;
    _height = imageToCrop.Height;
 }
예제 #3
0
        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;
            //}
        }
예제 #4
0
        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;
        }
예제 #5
0
 private void CropImage(ImageToCrop image, int x, int y, int w, int h, float zoom)
 {
     Bitmap mainImage = new Bitmap(image.Image.InputStream);
 }