OK , first of all you cant upload and tag photos at the same time. You need to upload the photo first then tag it . So the code will be
$args = array('message' => 'Testing photo tagging');
$args['image'] = '@' . realpath($FILE_PATH);
$data = $facebook->api('/me/photos', 'post', $args);
then we have to tag the users on the image , but i found that i cant tag more than one friend at the same time so i had to loop through the array. Another thing the value of X & Y in the tag array is not the px , its the percentage so those values will not exceed 100
$photo_id = $data['id'];
$tags = array(
array(
'tag_uid' => 1337904214,
'tag_text' => 'Joy',
'x' => 50,
'y' => 30
),
array(
'tag_uid' => 709019872,
'tag_text' => 'test',
'x' => 100,
'y' => 100
)
);
foreach($tags as $t) {
$t = array($t);
$t = json_encode($t);
try {
$facebook->api('/' . $photo_id . '/tags', 'post', array('tags' => $t));
} catch (Exception $e) {
print_r($e);
}
}
Good Luck !
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…