Exemplo n.º 1
0
        public async Task <ActionResult> ImageForBlobKey(string blobKey, string mimeType, int height, int width)
        {
            var image = await _blobRepo.GetImageAsync <MemoryStream>(blobKey);

            var resized = ImageResizer.ResizeToByteArray(image, 320, 180, false);

            return(new FileContentResult(resized, mimeType));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> DogThumbnail(int dogId, int size)
        {
            var dogImage = _dogImageRepo
                           .GetAll()
                           .FirstOrDefault(i => i.DogProfileID == dogId);

            if (dogImage == null)
            {
                return(null);
            }

            var imageStream = await _blobRepo.GetImageAsync <MemoryStream>(dogImage.BlobKey.ToString());

            var sizedImage = ImageResizer.ResizeToByteArray(imageStream, size, size, false);

            return(new FileContentResult(sizedImage, dogImage.MimeType));
        }