Reputation: 87
I need to generate a picture from facebook user profile picture and post it to some users' walls. For instance,
$attch = array( 'media' => array((array('type' => 'image',
'src' => 'https://graph.facebook.com/'.$uid.'/picture',
'href' => 'https://graph.facebook.com/'.$uid.'/picture/')));
'src' => 'https://graph.facebook.com/'.$uid.'/picture' line doesn't show any picture...
How can I resolve this?
Thanks
Upvotes: 0
Views: 1588
Reputation: 37661
You are going to the right place for the picture:
http://graph.facebook.com/[username or id]/picture/ returns a redirect to the image on Facebook's CDN.
You can try it in a browser.
I don't know what you're doing with that array but the likely problem with your code is that you are not following the redirect to find the actual image.
The image that the picture URL redirects to can change over time so you should always go to it first and follow the redirect.
Upvotes: 1
Reputation: 8785
I answered this in your duplicate question.
It's not showing a picture because there's nothing at https://graph.facebook.com/[user id]/picture. You need to query https://graph.facebook.com/[user id] and parse the JSON to get its URL.
Upvotes: 2