上传图片到粉丝专页问题

发布于 2024-11-27 07:57:14 字数 123 浏览 4 评论 0原文

..我正在尝试使用 FaceBookDesktop api for flash 将图像上传到 FB ....我 使用粉丝页面 ID 上传图片,但总是转到我自己的 专辑:/

有人有什么想法吗?

干杯

.. I'm trying uploade an image to FB using FaceBookDesktop api for flash .... I'm
using Fan page id to upload the picture but that always go to my own
album :/

Somebody have some idea ?

Cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

沫雨熙 2024-12-04 07:57:15

您是否尝试过发布到相册(即使用目标相册 ID)而不是粉丝页面本身?

var params:Object = {image:bitmap, fileName:'FILE_NAME'};
Facebook.api('ALBUM_ID/photos', myCallbackFunction, params, "POST");

Have you tried posting to an Album (ie using the target album id) instead of the fan page itself?

var params:Object = {image:bitmap, fileName:'FILE_NAME'};
Facebook.api('ALBUM_ID/photos', myCallbackFunction, params, "POST");
孤独患者 2024-12-04 07:57:15

默认情况下,上传图片会转到当前登录用户的页面。
您需要为您的粉丝页面获取身份验证令牌,以授权所有应用程序用户作为应用程序的上传者。因此,您将拥有用户和应用程序的令牌。如果您使用应用程序令牌,则可以上传它。

By default, uploading an image an image will go to the page of the currently logged in user.
You need to get an authentication token for your fan page that authorizes all app users as uploaders to the app. So you will have a token for the user and also for the app. If you us the app token you can upload it.

给我一枪 2024-12-04 07:57:15

我遇到了这个问题,我希望能够将图片上传到已记录的用户照片和我的应用帐户相册中。

我的意思是图片将始终上传到 Facebook 使用您的应用程序名称自动创建的相册中。一旦他们向您的应用程序授予权限,就会在您的帐户和登录的用户帐户中。

所以知道这一点后我做了以下事情。

为了管理权限,我使用具有所需权限的数组,

var permissions:Array = new Array("publish_stream", "user_photos" , "publish_actions");
FacebookDesktop.login(onLogin, permissions);

登录完成后我使用了它,然后我可以使用它上传图像

为了将照片上传到登录的用户相册

// photoBitmap is my image loaded and placed in a Bitmap var
// photoMessage is an string with the message you want to show in the image
// fileName is an string with the name you want to use for the image

    var photoParams:Object = {image: photoBitmap, message: photoMessage, fileName: photoName};

    FacebookDesktop.api("me/photos", uploadCompleteHandle, photoParams, "POST");

    function uploadCompleteHandle(success:Object, fail:Object):void{

        if(success){
           trace("Image uploaded successfuly");
           }else{
             trace("Fail uploading image");
             }
           }

为了将图像上传到应用程序帐户相册我使用这个:

var photoParams:Object = {image: photoBitmap, message: photoMessage, fileName: photoName, access_token: accessToken};

FacebookDesktop.api("/" + albumId + "/photos", uploadCompleteHandle, photoParams, "POST");

private function uploadCompleteHandle(success:Object, fail:Object):void{

    if(success){
       trace("Image uploaded successfuly");
       }else{
         trace("Fail uploading image");
         }
       }

请注意,什么它的变化是我添加了一个额外的参数(access_token)并进行了更改
("me/photos") 用于 ("/" + albumId + "/photos") 能够将照片上传到我的 Facebook 帐户中的任何相册专辑 ID。
如果您只想上传到应用程序相册,您可以使用("me/photos"),但我喜欢
("/" + albumId + "/photos") 因为我可以选择其他相册而不是 Facebook 自动创建的相册

要查找相册 ID,只需转到您在 Facebook 中的相册,然后在最后在页面中你可以看到类似这样的内容:
(https://www.facebook.com/media/set/?set=a.411960374564668.85712.100120829275312&type=3&l=216e24dddf)专辑ID是这部分100120829275312

对于此代码工作,您需要一个访问令牌。去找到一个你需要去的地方
您在 Facebook 中的应用程序设置并

在创建开放图谱协议时添加开放图谱协议为您的令牌选择此选项

操作类型 ->发布

对象->文章

当您选择操作类型时,请单击右侧链接(“获取代码”)

,您将看到一个窗口,其中包含许多可用于不同情况的代码。在这些代码里面
您可以看到 access_token 的值,是这样的

AAAGl5aaLlYYBAGqWHMGbxmasf354R15qXf12xAfOBFskr3OZBSEPw7H7rGt9bH4ZCwHS7Eoft9m8q91NYqzY3WOoGHYDnEgybsjONPNSoo8CZB7jdfsfsB

我希望这对你们有帮助
感谢您的阅读
:)

I had this issue, I wanted to be able to upload a picture to loged user photos and to my app account album.

I mean the picture will always upload in the album that facebook auto create with your app name. in your account and the loged user account once they give permissions to your app.

so knowing this I did the follow.

To manage permisions I use an Array with the permissions needed, I used this

var permissions:Array = new Array("publish_stream", "user_photos" , "publish_actions");
FacebookDesktop.login(onLogin, permissions);

when login is complete then I can upload the image using this

For upload photos to loged user album

// photoBitmap is my image loaded and placed in a Bitmap var
// photoMessage is an string with the message you want to show in the image
// fileName is an string with the name you want to use for the image

    var photoParams:Object = {image: photoBitmap, message: photoMessage, fileName: photoName};

    FacebookDesktop.api("me/photos", uploadCompleteHandle, photoParams, "POST");

    function uploadCompleteHandle(success:Object, fail:Object):void{

        if(success){
           trace("Image uploaded successfuly");
           }else{
             trace("Fail uploading image");
             }
           }

For upload the image to application account album I do use this:

var photoParams:Object = {image: photoBitmap, message: photoMessage, fileName: photoName, access_token: accessToken};

FacebookDesktop.api("/" + albumId + "/photos", uploadCompleteHandle, photoParams, "POST");

private function uploadCompleteHandle(success:Object, fail:Object):void{

    if(success){
       trace("Image uploaded successfuly");
       }else{
         trace("Fail uploading image");
         }
       }

Note that what its change is that I am adding an extra param (access_token) and change
("me/photos") for ("/" + albumId + "/photos") to be able to upload the photos to any photo album in my Facebook account using the Album ID.
if you only want to upload to application album you can use ("me/photos"), but I like
("/" + albumId + "/photos") cause I can choose a different album instead of the Facebook auto created album

To find the album ID simple go to your album in Facebook, and at the end of the page you can see someting like this:
(https://www.facebook.com/media/set/?set=a.411960374564668.85712.100120829275312&type=3&l=216e24dddf) the album ID is this part 100120829275312

for this code work you need an access_token. to get one you need to go to
your application setting in Facebook and add a Open Graph protocol

when creating the Open Graph protocol choose this options for your token

Action type -> Publish

Object -> Article

When you choose the Action type, do click on the right link ("Get Code")

and you will see a window with a lot of code to use for different case. inside those code
you can see the value for the access_token, is something like this

AAAGl5aaLlYYBAGqWHMGbxmasf354R15qXf12xAfOBFskr3OZBSEPw7H7rGt9bH4ZCwHS7Eoft9m8q91NYqzY3WOoGHYDnEgybsjONPNSoo8CZB7jdfsfsB

I hope this help you guys
Thanks for reading
:)

羁〃客ぐ 2024-12-04 07:57:14
var values:Object = {message:String(nomFotoASubir), fileName:'FILE_NAME',image: sub};
FacebookDesktop.api('/'+albumID+'/photos', handleUploadComplete, values,'POST');    

与 jBit 答案类似,我真的不知道是否需要第一个“/”...另一个。
可能导致错误的原因是您需要页面访问令牌而不是用户访问令牌。
您可以轻松获取此访问令牌,请参阅此说明和链接...

页面访问令牌

要以页面而非当前用户身份执行以下操作,您必须使用页面的访问令牌,而不是通常用于读取 Graph API 对象的用户访问令牌。可以通过使用manage_pages 权限向/USER_ID/accounts 发出HTTP GET 来检索此访问令牌。这将返回用户具有管理访问权限的页面(包括应用程序配置文件页面)列表,以及这些页面的 access_tokens。或者,您可以通过使用管理页面权限向 /PAGE_ID?fields=access_token 发出 HTTP GET 来获取单个特定页面的页面访问令牌,如上所述。除非另有说明,发布到页面还需要publish_stream权限。

开发者页面链接

如果某些答案是正确的,将其标记为正确,如果您有其他问题,请告诉我们,以便我们帮助您解决该问题以及其他人的类似问题...

var values:Object = {message:String(nomFotoASubir), fileName:'FILE_NAME',image: sub};
FacebookDesktop.api('/'+albumID+'/photos', handleUploadComplete, values,'POST');    

Similar to jBit answer, i dont really know if the first '/' is requiered... Anoth.
er thing that may cause the error is that you need the page access token and not your user access token.
You can obtain this access token easily, see this note and the link...

Page Access Tokens

To perform the following operations as a Page, and not the current user, you must use the Page's access token, not the user access token commonly used for reading Graph API objects. This access token can be retrieved by issuing an HTTP GET to /USER_ID/accounts with the manage_pages permission. This will return a list of Pages (including application profile Pages) to which the user has administrative access, along with access_tokens for those Pages. Alternatively, you can get a page access token for a single, specific, page by issuing an HTTP GET to /PAGE_ID?fields=access_token with the manage_pages permission, as described above. Publishing to a Page also requires the publish_stream permission, unless otherwise noted.

link to developers page

Please if some of the answers are correct, mark it as correct and if you have other problems lets us know so we could help you to solve the problem and the other people similars problems...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文