上传应用程序创建的图像时如何标记多个用户? Facebook/PHP/图形 API
这段代码工作正常:
$str1=$userid.'.jpg';
$facebook->setFileUploadSupport(true);
$data0 = array('tag_uid' => $bild1[1],'x' => rand() % 100,'y' => rand() % 100);
$datatags[] = json_encode($data0);
$access_token = $session['access_token'];
$result = $facebook->api('/me/photos', 'post', array(
'source' => '@'.realpath($str1),
'access_token' => $access_token,
'message' => 'My Hottest Friends',
'tags' => $datatags
));
但是当我添加这两行时,标记将不再工作:
...
$datatags[] = json_encode($data0);
$data1 = array('tag_uid' => $bild1[2],'x' => rand() % 100,'y' => rand() % 100);
$datatags[] = json_encode($data1);
$access_token = $session['access_token'];
...
我拥有publish_stream,user_photos,user_photo_video_tags权限。 有什么想法或者如何解决这个问题吗?
谢谢你!
This Code works fine:
$str1=$userid.'.jpg';
$facebook->setFileUploadSupport(true);
$data0 = array('tag_uid' => $bild1[1],'x' => rand() % 100,'y' => rand() % 100);
$datatags[] = json_encode($data0);
$access_token = $session['access_token'];
$result = $facebook->api('/me/photos', 'post', array(
'source' => '@'.realpath($str1),
'access_token' => $access_token,
'message' => 'My Hottest Friends',
'tags' => $datatags
));
But the tagging will not work anymore, when I add these two lines:
...
$datatags[] = json_encode($data0);
$data1 = array('tag_uid' => $bild1[2],'x' => rand() % 100,'y' => rand() % 100);
$datatags[] = json_encode($data1);
$access_token = $session['access_token'];
...
I have the publish_stream,user_photos,user_photo_video_tags permissions.
Any ideas why or how to solve the problem?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
除了一一标记每个用户之外,没有找到其他解决方案。上传中的第一个,如第一个代码片段,然后:
非常感谢,@ifaour
Found no other solution but to tag each user one by one. First one in the upload like in the first code snippet and then:
Thank you very much, @ifaour
我能够使用 Javascript 一次添加多个标签来向图形 api 发出请求,我假设您可以使同样的事情与您的答案一起工作,只需在调用 file_get_contents 之前将 json 对象添加到 url 中即可。我使用的代码如下:
I was able to add multiple tags at once using Javascript to make a request to the graph api, I would assume you could make the same thing work with your answer, just add the json object to the url before calling file_get_contents. The code I used is below: