Facebook API/PHP - Is it possible to change a user's profile image via FB Graph API?

后端 未结 5 784
栀梦
栀梦 2020-12-01 08:28

Is it possible to set/change a user\'s facebook profile image through the graph API?

I can\'t find a specific API method, but it is possible to upload an image to a

相关标签:
5条回答
  • 2020-12-01 08:57

    See the "Publishing" section here: http://developers.facebook.com/docs/reference/api/photo

    Requires the publish_stream permission.

    To publish a photo, issue a POST request with the photo file attachment as multipart/form-data.

    You can publish an individual photo to a user profile with a POST to http://graph.facebook.com/PROFILE_ID/photos We automatically create an album for your application if it does not already exist. All photos from your application will be published to the same automatically created album.

    You can publish a photo to a specific, existing photo album with a POST to http://graph.facebook.com/ALBUM_ID/photos.

    The last sentence states you can publish to an existing album, so if you're trying to update the user's profile picture (not sure from the way you stated your question), try getting the album ID for the user, then publishing to that.

    0 讨论(0)
  • 2020-12-01 09:02

    Currently this is possible by redirecting the user to the mobile profile pic change url, https://m.facebook.com/photo.php?fbid=[fb photo id]&prof&ls=your_photo_permalink

    The previous work around, using the facebook.com/photo.php?pid=[fb photo id]&makeprofile=1 url no longer works.

    0 讨论(0)
  • 2020-12-01 09:03

    No, And here's a comment from a guy at facebook:

    This Is A A Facebook Developer!

    The Original Link - you have to press show comments

    0 讨论(0)
  • 2020-12-01 09:06

    We can do a trick by uploading user’s photo to Facebook via the API then redirect the user to uploaded photo URL with makeprofile=1 added to the list of query strings:

    facebook.com/photo.php?pid=xyz&id=abc&makeprofile=1
    

    Check Auto Change Facebook Profile Picture to get PHP example and demo.

    0 讨论(0)
  • 2020-12-01 09:07

    To the best of my knowledge and experience: No.

    0 讨论(0)
提交回复
热议问题