Reputation: 21
I use this codes , but I get an error
Fatal error: Uncaught OAuthException: (#121) Invalid photo id thrown in /home/a283357/public_html/app/base_facebook.php on line 1106
MY codes are for tags
$data = array(array('tag_uid' => $friends, 'x' => rand() % 100, 'y' => rand() % 100 ));
$data = json_encode($data);
//, 'tags' => $data,
$photo_details = array( 'message'=> 'message ', 'tags' => $data, 'image' => '@' . realpath($file) );
$upload_photo = $facebook->api('/'.$album_uid.'/photos', 'post', $photo_details);
And I want to tags 5 or 10 friends
Upvotes: 2
Views: 2622
Reputation: 25918
You cannot specify the tags for photo while creating it. Also you using wrong names for parameters used in create photo method.
You should create the photo first and then tag it.
Create photo:
$photo_details = array(
'message'=> 'message ',
'source' => '@' . realpath($file)
);
$uploaded_photo = $facebook->api('/'.$album_uid.'/photos', 'post', $photo_details);
Now tag it:
$tags = array(
array('tag_uid' => $friend_id, 'x' => rand() % 100, 'y' => rand() % 100 )
);
$photo_id = $uploaded_photo['id'];
$facebook->api('/'.$photo_id.'/tags', 'post', array('tags'=>$tags));
BEWARE, documentation states to
parameter as one to specify the tagged user, but it's not (it's tag_uid
as in your initial sample).
Upvotes: 2