简体   繁体   English

使用Facebook Graph API发布公共照片

[英]Post a public photo using the Facebook Graph API

I'm using the Facebook Graph API to post a photo to a user's album. 我正在使用Facebook Graph API将照片发布到用户的相册中。

The posting of the photo works and is created in the requested album but I have been unable to make the photo public. 照片已发布并在请求的相册中创建,但我无法将照片公开。

The album is set to public and other photos in the album are available to logged out users. 相册设置为公开,相册中的其他照片可供注销用户使用。 When the user gives permission to the app they also select that anything posted by the app is made public. 当用户授予该应用程序许可时,他们还选择将该应用程序发布的所有内容公开。 Any ideas why this is happening? 任何想法为什么会这样?

Here is the code: 这是代码:

$ret_obj = $this->facebook->api('123123123/photos', 'POST', array(
    'source' => '@' . $photo,
    'message' => $message,
));

These are the permissions I'm asking for: 这些是我要求的权限:

$url = $this->facebook->getLoginUrl( array(
    'scope' => 'photo_upload, user_photos, publish_stream'
));

As per the Reference docs (which did not contain this information, but I've since added) you need to supply an additional privacy parameter in your API call, which I believe looks like this (my PHP is not strong): 根据参考文档 (其中不包含此信息,但是我已经添加了),您需要在API调用中提供一个附加的privacy参数,我相信它看起来像这样(我的PHP不强):

$privacy = array(
  'value'=> 'EVERYONE',
)

$ret_obj = $this->facebook->api('123123123/photos', 'POST', array(
                                 'source' => '@' . $photo,
                                 'message' => $message,
                                 'privacy' => $privacy
                                 )
                              );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM