标记好友照片 [英] Tags friends photo

查看:87
本文介绍了标记好友照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此代码,但出现错误

I use this codes , but I get an error

致命错误:未捕获的OAuthException:(#121)在第1106行的/home/a283357/public_html/app/base_facebook.php中抛出了无效的照片ID

Fatal error: Uncaught OAuthException: (#121) Invalid photo id thrown in /home/a283357/public_html/app/base_facebook.php on line 1106

我的代码用于标签

$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);

我想标记5个或10个朋友

And I want to tags 5 or 10 friends

推荐答案

创建照片时,无法为照片指定标签.另外,您为创建照片方法中使用的参数使用了错误的名称.

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.

创建照片:

$photo_details = array(
  'message'=> 'message ',
  'source' => '@' . realpath($file)
);
$uploaded_photo = $facebook->api('/'.$album_uid.'/photos', 'post', $photo_details);

现在标记它:

$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));

注意 文档状态to参数作为指定被标记用户的一种,但不是(与您的初始示例中的tag_uid一样).

这篇关于标记好友照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆