Facebook graph api 图片来自文件上传?

标签 facebook facebook-graph-api

在 facebook graph api 中,我们有一个属性(图片),用于在帖子中附加图像。图像的来源必须是服务器上的某个位置。我的页面有文件上传控件,可以使用上传的图片(尚未提交)代替服务器上的图片吗?

我需要为用户提供从他/她的计算机上传图像的选项,并且该图像将使用图形 API 发布在 Facebook 上。但由于我没有图像的路径,我该怎么做呢?

最佳答案

摘自 Facebook 文档“如何做”:

Publishing an Photo

In order to publish a photo to a user’s album, you must have the publish_stream permission. With that granted, you can upload a photo by issuing an HTTP POST request with the photo content and an optional description to one these to Graph API connections:

https://graph.facebook.com/USER_ID/photos - The photo will be published to an album created for your app. We automatically create an album for your app if it does not already exist. All photos uploaded this way will then be added to this same album.

...

Uploading a photo to your app’s album. Creating a new album and uploading a photo to the album you create.

https://developers.facebook.com/blog/post/498/

此外,您还可以使用Graph方法上传照片/me/photos

关于Facebook graph api 图片来自文件上传?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9545297/

相关文章:

html - 嵌入 Facebook 帖子高度

facebook - 如何通过 Facebook API 删除 Facebook 消息?

facebook-graph-api - (#100) Action Type <type :action>is not approved, 所以 app <app-id> 只能发布给 app 的管理员、开发者和测试者

python - 使用 FacePy 无法在 Facebook 中搜索群组

javascript - 无法通过 Facebook 集成获取用户电子邮件

python - 测试 Django Facebook 应用程序

javascript - 如何使用 FB.api Javascript SDK 将视频发布到 Facebook?

facebook - 允许用户添加 disqus/facebook 评论插件

javascript - 为 Facebook 按钮启用 Onclick 方法

facebook - Graph API 资源管理器中的“保存 session ”按钮在哪里