Exemplo n.º 1
0
        public IActionResult PostImage([FromBody] myImage myImage)
        {
            var testing = myImage.ImageString;
            var test    = testing.Length;
            var result  = _imageProcess.ResizeImage(myImage.ImageString, 50, 50, "test");

            if (result.IsSuccess)
            {
                return(Ok(new myImage()
                {
                    ImageString = result.Value.GetDataUri()
                }));
            }
            return(StatusCode(503));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Return a copy of the image specified by 'key', scaled according to the dimensions of the visual container (i.e. frame) it will be viewed in.
        /// </summary>
        /// <param name="key">the unique identifier for the image to be returned</param>
        /// <param name="frameWidth">the width (in pixels) of the 'frame' it is to occupy</param>
        /// <param name="frameHeight">the height (in pixles) of the 'frame' it is to occupy</param>
        /// <returns>the Image pointed identified by key</returns>
        public Image GetImage(string key, int frameWidth, int frameHeight)
        {
            // Get the Image from the Dictionary at a certain key
            Image originalImage = _imageFiles[key];
            // Resize the Image with the specific width and height
            Image imageToGet = _imageProcess.ResizeImage(originalImage, frameWidth, frameHeight);

            return(imageToGet);
        }