Badges.Controllers.ProfileController.CropAndSave C# (CSharp) Method

CropAndSave() private method

Crops the image to the given size, saves, and returns the url of the final blob
private CropAndSave ( System.Web.HttpPostedFileBase image, int width, int height ) : string
image System.Web.HttpPostedFileBase
width int
height int
return string
        private string CropAndSave(HttpPostedFileBase image, int width, int height)
        {
            var cropResizer = new ResizeSettings(width, height, FitMode.Crop, null);

            using (var stream = new MemoryStream())
            {
                ImageBuilder.Current.Build(image.InputStream, stream, cropResizer, disposeSource: false);

                //save the original and modified image
                var blob = _fileService.Save(image.InputStream, stream, image.ContentType, publicAccess: true);

                return blob.Uri.AbsoluteUri;
            }
        }