private byte[] getPicture(string photoPath) { string fileName = HttpContext.Server.MapPath(photoPath); var imageData = FileBinaryConvertor.GetFile(fileName); return(imageData); }
public FileContentResult UserPhoto(string userID = "") { ApplicationUser user; if (userID == "") { user = CurrentUser; } else { user = db.Users.FirstOrDefault(x => x.Id == userID); } if (user != null && userHasPhoto(user)) { return(new FileContentResult(user.Photo, "image/jpeg")); } else { string fileName = HttpContext.Server.MapPath(@"~/Content/Images/storyteller.jpg"); var imageData = FileBinaryConvertor.GetFile(fileName); return(File(imageData, "image/png")); } }