Tags friends photo

徘徊边缘 提交于 2019-12-13 16:18:46

问题


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


回答1:


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).



来源:https://stackoverflow.com/questions/10108119/tags-friends-photo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!