예제 #1
0
        public async Task <IActionResult> GetImagenProdcuto(int idPublicacion)
        {
            string pathImage = await _coFachada.GetImagenProdcuto(idPublicacion);

            var    ext         = Path.GetExtension(pathImage).ToLowerInvariant();
            string mimeTypeExt = "";

            switch (ext)
            {
            case ".jpg":
            case ".jpeg":
                mimeTypeExt = "jpg";
                break;

            case ".png":
                mimeTypeExt = "png";
                break;

            default:
                mimeTypeExt = "jpg";
                break;
            }

            return(PhysicalFile(pathImage, $@"image/{mimeTypeExt}"));
        }