Пример #1
0
 public string GetPublicImageUrl(FacebookPictureSize size = FacebookPictureSize.Large)
 {
     return string.Format("http://graph.facebook.com/{0}/picture?type={1}", Id, size.ToString().ToLower());
 }
Пример #2
0
        public async Task<FacebookPicture> GetPicture(IdentityUser user, string contentId, FacebookPictureSize size = FacebookPictureSize.Normal)
        {
            var accessToken = GetAccessToken(user);
            var client = new FacebookClient(accessToken);
            var data = await client.GetTaskAsync(string.Format("{0}/picture?redirect=false&type={1}", contentId, size.ToString().ToLower()));

            var settings = new JsonSerializerSettings
            {
                MissingMemberHandling = MissingMemberHandling.Ignore,
                NullValueHandling = NullValueHandling.Ignore
            };
            var picture = JsonConvert.DeserializeObject<FacebookDataWrapper<FacebookPicture>>(data.ToString(), settings);

            Log.InfoFormat("Pulled Facebook picture.  UserId={0} ContentId={1} Url={2}", user.Id, contentId, picture.Data.Url);

            return picture.Data;
        }