Reputation: 2777
I'm reading wildly different things about tagging photos on Facebook.
One article says you can send tags=array(...tag_uid...)
at the same time as you post the photo: Tagging photos on Facebook with Graph API / PHP SDK
One article said you can tag, but first you have to post to photo, and then set tags afterwards. (Can't remember the page)
One article said you can tag, but only one tag per request, so you have to iterate over the array. (Can't remember the page)
One article says you can't tag at all: https://developers.facebook.com/blog/post/371/
Does anyone know if tagging actually possible, and what is the correct way of doing it as of the current date?
Upvotes: 2
Views: 135
Reputation: 31
You must get Photo ID firs and then tag someone on this photo
upload photo to album
$photo_details = array( 'message' => $message, 'access_token' => $token );
$photo_details['image'] = '@' . realpath($file);
$uploaded_photo = $facebook->api('/'.$album_uid.'/photos', 'post', $photo_details);
Get Photo ID
$photo_id = $uploaded_photo['id'];
set Friend ID you want to tag
$tags = array( array('tag_uid' => $friend_id, 'x' => rand() % 100, 'y' => rand() % 100 ) );
tag friend
$facebook->api('/'.$photo_id.'/tags', 'post', array('tags'=>$tags));
It works for me, I hope this will help you
Upvotes: 1