コード例 #1
0
        public JsonResult CropImage(int?xCoordinate, int?yCoordinate, int?width, int?height, string filename)
        {
            if (!xCoordinate.HasValue || !yCoordinate.HasValue || !width.HasValue || !height.HasValue)
            {
                return(Json(new { errorMessage = "Fail!" }));
            }
            var imageName = filename.Replace(ImagePath, "").Trim('/');

            var croppedImagePath = UploadHelper.CropAndSave(ImagePath, imageName, width.Value, height.Value, xCoordinate.Value, yCoordinate.Value);

            return(Json(new { filename = croppedImagePath }));
        }