在 Facebook 中上传/标记照片时 PhotosDuplicateTagInBatch 错误!
我正在编写一个应用程序,允许用户一次上传多张照片到 Facebook,当发生这种情况时,它会自动在照片中标记自己(没有其他人)。
如果我运行该脚本一次,它就可以正常工作,如果我尝试上传并标记多张照片,它就会抱怨 PhotosDuplicateTagInBatch
错误,并且我找不到任何关于为什么会发生这种情况的信息!
这是我的代码:
for ($i = 5; $i >= 1; $i--)
{
$img = GetImage($i);
$tag = array(
'tag_uid' => $facebook->getUser(),
'x' => rand (0,100),
'y' => rand (0,100)
);
$tags[] = json_encode($tag);
$args = array(
'message' => $i,
'image' => '@'.realpath($img),
'tags' => $tags,
);
$data = $facebook->api('/me/photos', 'post', $args);
}
}
如果我输出我的参数,它们会显示为: 代码:
Array
(
[message] => 4
[image] => @imagepathhere
[tags] => Array
(
[0] => {"tag_uid":"100002493436028","x":13,"y":68}
[1] => {"tag_uid":"100002493436028","x":60,"y":57}
)
)
I am writing an application that allows users to upload multiple photos at once to facebook and it will automatically tag themselves (no one else) in the photo when this happens.
If I run the script once, it works fine, if I try to upload and tag multiple photos then it complains with a PhotosDuplicateTagInBatch
error and I can't find ANY information as to why this is happening!
Here is my code:
for ($i = 5; $i >= 1; $i--)
{
$img = GetImage($i);
$tag = array(
'tag_uid' => $facebook->getUser(),
'x' => rand (0,100),
'y' => rand (0,100)
);
$tags[] = json_encode($tag);
$args = array(
'message' => $i,
'image' => '@'.realpath($img),
'tags' => $tags,
);
$data = $facebook->api('/me/photos', 'post', $args);
}
}
If I output my arguments they come out as:
Code:
Array
(
[message] => 4
[image] => @imagepathhere
[tags] => Array
(
[0] => {"tag_uid":"100002493436028","x":13,"y":68}
[1] => {"tag_uid":"100002493436028","x":60,"y":57}
)
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以本质上,据我所知,你不能像这样上传和标记多张照片。我要做的就是上传照片,然后单独标记并冲洗并重复
So essentially, from what I can tell, you cannot upload and tag multiple photos like this. What I had to do was upload the photo, then tag it separately and rinse and repeat