Agribusiness.Web.Controllers.PersonController.GetThumbnail C# (CSharp) Method

GetThumbnail() public method

public GetThumbnail ( int id ) : System.Web.Mvc.ActionResult
id int
return System.Web.Mvc.ActionResult
        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");
        }