Created
May 8, 2014 15:18
-
-
Save weslley39/b025607b08351505e793 to your computer and use it in GitHub Desktop.
Show Img Mongo C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public FileContentResult MostraImagem(string id) | |
{ | |
var imagem = FileService.BuscarPorId(id).OpenRead(); | |
byte[] imagemEmBytes = new byte[imagem.Length]; | |
using (BinaryReader leitor = new BinaryReader(imagem)) | |
{ | |
imagemEmBytes = leitor.ReadBytes((int)imagem.Length); | |
} | |
return new FileContentResult(imagemEmBytes, "image/jpeg"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment