How to get picture of user who has commented on my facebook post?

瘦欲@ 提交于 2019-12-13 05:08:55

问题


I have post_id of the status which user share by iOS app, Now with graph api, I'm getting comment info and like info:

POST_ID?fields=likes.fields(pic_square,name),comments

With above, I'm able to fetch most of the details, but not profile pic of user who commented on post. check details which I'm getting:-

{
  "id": "POST_ID", 
  "updated_time": "2014-03-25T07:07:14+0000", 
  "likes": {
    "data": [
      {
        "pic_square": "https://fbcdn-profile-a.akamaihd.net/static- ak/rsrc.php/v2/yo/r/UlIqmHJn-SK.gif", 
        "name": "User name", 
        "id": "100007640XXXXX"
      }
    ], 
    "paging": {
      "cursors": {
        "after": "MTAwMDA3NjQwMzcxMzQxxx", 
        "before": "MTAwMDA3NjQwMzcxMzQxxx"
      }
    }
  }, 
  "comments": {
    "data": [
      {
        "id": "2069772628xxxxxx", 
        "from": {
                 "name": "user name", 
                 "id": "100007640xxxxxx"
                }, 
        "message": "great reader..", 
        "can_remove": true, 
        "created_time": "2014-03-26T06:19:36+0000", 
        "like_count": 0, 
        "user_likes": false
      }
    ], 
    "paging": {
          "cursors": {
          "after": "MQ==", 
         "before": "MQ=="
      }
    }
  }
}

Now I need picture of a user who commented on post, I'm getting picture of user who likes, but not who commented. I tried to get it with FQL but not succeed.


回答1:


Here in response you are getting user id who had liked your post so use that as follows

https://graph.facebook.com/10000445993xxxxx/picture?type=large




回答2:


Use this API:

https://graph.facebook.com/100007640xxxxxx/picture

100007640xxxxxx: is userid.

Edit:

if you want to load user picture in particular size then you can use following:

https://graph.facebook.com/100007640xxxxxx/picture?width=150&height=150



来源:https://stackoverflow.com/questions/22687039/how-to-get-picture-of-user-who-has-commented-on-my-facebook-post

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!