在 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/