I am trying to fetch data from user's wall and it goes well - just simple request to Facebook Graph API:
https://graph.facebook.com/me/feed?access_token=...
However it returns:
"data": [
{
"id": "1337_123",
"from": {
"name": "Johny Rambo",
"id": "1337"
},
"message": "hello world",
...
},
...
]
What I also need is author's avatar (picture) - in that case Johny Rambo
.
I can ask Facebook API for it with other request like:
https://graph.facebook.com/1337?access_token=...&format=json&fields=name,picture
But it makes a n+1
requests to the API (n
- number of wall posts if authors are unique).
Is it possible to modify main request for wall posts to fetch from
section with users' pictures like below ?
"from": {
"name": "Johny Rambo",
"id": "1337",
"picture": "http://profile.ak.fbcdn.net/......jpg"
},
You can simply use the ID as the image with /picture
:
<img src="https://graph.facebook.com/1337/picture"/>
You can render the current profile photo for any object by adding the suffix /picture to the object URL.
For more information, have a look at the documentation here under "pictures".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With