public ActionResult GetThumbnail(int? id)
{
if(id != null)
{
var person = Repository.OfType<Person>().GetById(id.Value);
if(person.MainProfilePicture != null)
{
return File(person.ThumbnailPicture, person.ContentType ?? "image/png");
}
}
// load the default image
var fs = new FileStream(Server.MapPath("~/Images/profileplaceholder_thumb.png"), FileMode.Open, FileAccess.Read);
var img = new byte[fs.Length];
fs.Read(img, 0, img.Length);
fs.Close();
return File(img, "image/png");
}