Link between current profile picture and the original photo in the profile album - facebook

I want to have a link between the currently used profile picture and the original source in the profile album.
I'm getting the profile picture with:
/me/picture?redirect=false
Which will return url, width & height but unfortunately no id. (https://developers.facebook.com/docs/graph-api/reference/profile-picture-source/)
I'm getting all the albums with:
/me/albums?fields=id,type
Then I'm iterating through all the albums to find the one with the type=='profile' and then retrieve all the photos of this album:
/{albumId}/photos?fields=width,height,id,images
How can I identify the photo used as the profile picture?
Since we have no id returned from the /me/picture endpoint I don't see a way to make the link between the two objects.
Also, I'm not sure that we can rely on CDN urls to parse them and try to find the profile picture id.

Related

FaceBook get the bigger profile image

I an using this url to get the image profile of user:
http://graph.facebook.com/userid/picture?type=large
But i noticed that i get image profile in 180*135 and i see that the image profile in my face book profile is more big then this.
It is possible to get the real image? or the large is the maximum?
Well, there is. You would have to create a facebook app, request access to the users picture albums, retrieve the images from the "Profile Pictures" album and scan that album for the currently used image.
If you have luck, its always the first image in the album. If not, you are in trouble and would have to do image comparsions.

Get the name of the album from a tagged photo using Graph API

I am able to grab album name and photos uploaded by the user using the graph api.
When I use "https://graph.facebook.com/me/photos?access_token=".$access_token", I get all the tagged photos of the user. Is there a way to get the name of the album of a photo, which has not been uploaded by the user but by his friend?
Thanks
I don't think you can get that directly, but using the "link" attribute you can quickly suss it out, as seen in this example:
"link": "http://www.facebook.com/photo.php?fbid=10150154222339657&set=a.358879884656.199726.249427954656&type=1"
That set parameter and fbid tell you much more about the photo.
You can view more details about the photo by going to the page for it. It will tell you the position in the album, though it still won't have the album:
http://graph.facebook.com/10150154222339657
You can however determine the album id from the set parameter, the album id is the between the a. and the second ., so in this example the album id is 358879884656
So, the album info would be available at:
http://graph.facebook.com/358879884656

Facebook Graph API wont return photo source for photos uploaded by apps

When getting the "me/home" stream there is a difference between the photo objects i get in return. Some of them are returned with the source field (URL to the actual picture) and some not.
After investigating i learned that for photos uploaded to Facebook using the website itself there is the source and images fields in the object,
But for photos uploaded to Facebook by some kind of app (has the "application" field) there are no source/images fields, only a "link" field which direct me to the photo page (whole page, not just the photo)
Does that means i cant get the actual picture file for pics uploaded by apps ? am i missing something?
Update: The photos without the source field are "public".
You can use FQL to get very detailed information about the photo
SELECT src_big FROM photo WHERE pid='{photoId}'
For more information on what you can get from the FQL table see: http://developers.facebook.com/docs/reference/fql/photo/
Note: the quotes around the photo id is required as it is a string value

How to get cover photo of album and photos of the album using FBGraph Api

I am working with FBGraphAPI in my project. I managed to get the list of albums. I tried to get picutre (cover_photo) and photos in albums. But somehow i stuck in it.
Which inbuilt method i need to use to get cover_photo and photos in the album? And how to use it?
To get the cover_photo, you need to use
https://graph.facebook.com/<id>/picture?type=album&access_token=<token>
where id is the cover_photo from your album returned in the album list.
and token is your current session token
Note. It needs to be https and you need to specify the token. This is what makes it different than, for example, rendering a user's photo.
By photos in album, not sure if you mean the list of photos or the actual photo itself?
The basic process is to use the id of the album returned and then call
https://graph.facebook.com/<id>/photos
This will return a list of photos in the album.
Within this list will be 'source' which contains the url of the photo.
Also a dictionary of different photo resolutions.

Facebook Connect for iPhone: How to upload an image (UIImage) to user's wall without having to use json-embedded link or photos.upload?

Is there any way to upload an image (UIImage) directly from an iPhone app to a user's wall/feed?
All the samples I see are either using a json-embedded link or they use the photos.upload call with album ID (aid) which results in the user getting the image in his photo album(s).
What I want to do is to upload an (UI)Image created (by the user) inside an iPhone app and upload to his/her wall. Is this possible? Sample code would be highly appreciated.
This isn't possible. To understand why, you have to consider the conceptual model that Facebook currently uses: Posts on a user's wall are just bits of text optionally attached to some link URL. That link URL can be some random image on the web, or it can just as well be an image that the user already has in their photo albums.
But a wall post cannot inherently "contain" an image in and of itself. Therefore you need to host the image somewhere, be it on your own site, or on Facebook itself, inside one of the user's albums by uploading it first to there.
I'm trying to figure out the same thing myself. One thing I did find out is that if you post the "Wall Photos" album they do get posted to the wall. However you only have a wall photos album if you've uploaded photos to your wall from your profile page before. And even then, you need to get the album aid and then post to it.
EDIT
Found a much better solution. First upload the photo to your default album, then make a post to the wall with the link to your photo that was returned when uploading (not a link to the image but the page the image is on).