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

后端 未结 5 846
栀梦
栀梦 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.

提交回复
热议问题