Пример #1
0
        private ActionResult IllegalCrop(ImageParameters parameters)
        {
            var caption = $"Acceptable crops:\n{string.Join("\n", Configuration.Crops.Select(m => $"{m.Name}"))}";
            var image   = ImageController.GetCaption(caption);

            this.Response.RegisterForDispose(image);

            ImageController.Resize(image, parameters);

            return(this.BadRequest(image));
        }
Пример #2
0
        private ActionResult NotFound(ImageParameters parameters)
        {
            var image = ImageController.GetCaption("Not found");

            this.Response.RegisterForDispose(image);

            ImageController.Crop(image, parameters, new ImageDetails(3797 / 2, 5315 / 2));
            ImageController.Resize(image, parameters);
            ImageController.Quality(image, parameters);

            return(this.NotFound(image));
        }
Пример #3
0
        private async Task <ActionResult> Process(ImageParameters parameters)
        {
            var details = await ImageDetails.GetById(parameters.Id);

            var image = await ImageController.GetImage(parameters.Id);

            this.Response.RegisterForDispose(image);

            ImageController.Crop(image, parameters, details);
            ImageController.Resize(image, parameters);
            ImageController.Quality(image, parameters);
            ImageController.Metadata(image, details);

            return(this.Ok(image));
        }