I am working on the API for a mobile application, which for the sake of argument is much like Foursquare and Instagram. Both of those applications will allow you to upload photos to your Facebook profile.
These will be added to a "Foursquare Photos" album, which will be made if it does not exist and you see it in your "Albums" area. Every time you add a new image it will become the album cover and you will see it displayed at the start of your album, so that images are in reverse chronological order (newest at the top/left, oldest bottom right).
To set the cover I assumed I could simply do this:
That is my attempt to post an update to the album ID, setting cover_photo
as the photo ID of a file I've just uploaded. I have created the album fine, uploaded the photo fine all using the same access token - so we know it's not scopes (because yes I definitely have user_photos
on the token).
A second approach was to assume this is automatic and try uploading a photo to the "start" of an album using the "position" field, but when I make a POST it seems to be completely ignored:
$photo = $facebook->api("/{$album_id}/photos", 'POST', array(
'access_token' => $token->oauth_token,
'image' => '@'.$filename,
'no_story' => 1,
'position' => 1,
'from' => array(
'id' => $user_opp->user->facebook_uid,
),
));
That uploads the image fine, but puts it at the end of the album, not the start.
So, how the f**k does this work? I've Googled my arse off and got nowhere. Tried the IRC and had no response, tried the Facebook Developer forums and they're down. I don't have any goats to sacrifice but maybe somebody out there knows.
batch
of photos. So, although Facebook uses the last photo, it is impossible to predict 100% which photo will be last. :) - wuliwong