15

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 user's album (http://developers.facebook.com/docs/reference/api/photo). Can I set the user's profile image to an image uploaded to their album?

Edit:
Same question asked in reference to REST API
Can I set a users profile image using the Facebook API?

Community
  • 1
  • 1
John Himmelman
  • 21,504
  • 22
  • 65
  • 80
  • possible duplicate of [Can I set a users profile image using the Facebook API?](http://stackoverflow.com/questions/1648859/can-i-set-a-users-profile-image-using-the-facebook-api) – ajreal Dec 06 '10 at 20:39
  • @Ajreal I found that question before posting but it only had one response and there were many api changes/additions since it was posted. – John Himmelman Feb 03 '11 at 21:07

5 Answers5

17

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

Tom Granot
  • 1,840
  • 4
  • 22
  • 52
10

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.

Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156
Hoan
  • 117
  • 1
  • 2
9

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.

ggtsu
  • 101
  • 1
  • 4
3

To the best of my knowledge and experience: No.

Peter Bailey
  • 105,256
  • 31
  • 182
  • 206
2

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.

Matt Huggins
  • 81,398
  • 36
  • 149
  • 218
  • Thanks Matt,for your help.I am able to crate an album.But When I am trying to add image in that album I am getting an error.(message": "(#324) Requires upload file").I am doing in C#.Here is my web request. `https://graph.facebook.com/pageid/photos?access_token=application_access_token&method=post&message=waterfall&source=D:\Image\image1.jpg` .I know request should be made in multiple part.I written in code.Not directly in web request. – Komal Jul 29 '11 at 05:42
  • 2
    You can't just pass a location on your hard drive in a URL, the server won't know what to do with that. Check out [this Facebook blog post](https://developers.facebook.com/blog/post/498/) that explains uploading photos through the Graph API. – Matt Huggins Jul 29 '11 at 15:35