Facebook发布与图像(object_attachment)。图片是空的。为什么? [英] facebook post with image (object_attachment). Image is empty. Why?

查看:280
本文介绍了Facebook发布与图像(object_attachment)。图片是空的。为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建发布到Facebook与我的应用程序的形象。
图像存储在应用程序。

I have to create post to facebook with image from my application.
Image stored in application.

我做的:

  1. 上传图片到用户的照片 Request.newUploadPhotoRequest 和接收照片的证件 来自Facebook。例如,我收到637590962949508

  1. Upload image to user photos with Request.newUploadPhotoRequest and receive photo id from Facebook. For example, I receive "637590962949508".

创建后并发送至Facebook有:
请求(会话,我/饲料,postParams,HttpMethod.POST,回调)
postParams 我也把 postParams.putString(object_attachment,PHOTOID),其中 PHOTOID = 637590962949508

Create post and send to Facebook with:
Request(session, "me/feed", postParams, HttpMethod.POST, callback).
In postParams I also put postParams.putString("object_attachment", photoId) where photoId = "637590962949508"

回应是:

{
  Response:  responseCode: 200,
  graphObject: GraphObject{
    graphObjectClass=GraphObject,
    state={
      "id":"100000958302790_637591166282821"
    }
  },
  error: null,
  isFromCache:false
}

正如我所看到的,Facebook的告诉我,一切正常。由于结果是:我能看到帖子在我的饲料,但图像是空的(空方)。但图像中存在的照片。

As I can see, Facebook tells me that all is ok. As result: I can see post in my feed but the image is empty (empty square). But image is exists in photos.

在哪里是一个错误?

推荐答案

我曾与Facebook同样的问题。你的情况的Facebook不能显示图像的缩略图,但是当你点击后,你可以看到你的照片在全屏视图。 要纠正你的帖子,你必须通过调用图形API/ {PHOTOID}(的 https://developers.facebook.com/docs/graph-api/reference/photo ),你会得到JSON类似于:

I had the same issue with facebook. In your case facebook cannot show a thumbnail of your image, but when you click on the post you can see your photo in full screen view. To correct your post you have to get details of your uploaded photo by calling graph api "/{photoId}" (https://developers.facebook.com/docs/graph-api/reference/photo) and you'll get JSON similar to:

{
"created_time" = "";
from =     {
    id = 100002300000000;
    name = "User User";
};
height = 500;
id = 62902XXXXX;
images =     (
            {
        height = 500;
        source = "https://scontent-b.xx.fbcdn.net/hphotos-frc3/t1.0-9/XXXX.jpg";
        width = 500;
    },
            {
        height = 480;
        source = "https://scontent-b.xx.fbcdn.net/hphotos-frc3/t1.0-9/p480x480/XXXX.jpg";
        width = 480;
    },
            {
        height = 320;
        source = "https://scontent-b.xx.fbcdn.net/hphotos-frc3/t1.0-9/p320x320/XXXX.jpg";
        width = 320;
    },
            {
        height = 130;
        source = "https://fbcdn-photos-h-a.akamaihd.net/hphotos-ak-frc3/t1.0-0/XXXX.jpg";
        width = 130;
    },
            {
        height = 225;
        source = "https://scontent-b.xx.fbcdn.net/hphotos-frc3/t1.0-9/p75x225/XXXX.jpg";
        width = 225;
    }
);
link = "https://www.facebook.com/photo.php?fbid=629020720517945&set=a.628961963857154.1073741825.100002300681060&type=1";
picture = "https://fbcdn-photos-h-a.akamaihd.net/hphotos-ak-frc3/t1.0-0/1029_XXX.jpg";
source = "https://scontent-b.xx.fbcdn.net/hphotos-frc3/t1.0-9/1029_XXX.jpg";
width = 500;
}

这是你应该采取的图像阵列的响应,然后缩略图的一个源链接。 此链接可以添加到人体后与/我/饲料API图片(的 https://developers.facebook.com/docs/graph-api/reference/user/feed/ )。

From the response you should take "images" array and then one of the thumbnails "source" link. This link you can add to post body with "picture" key on "/me/feed" API (https://developers.facebook.com/docs/graph-api/reference/user/feed/).

注意:你必须调用user_photos权限,以达到照片信息

Attention: you have to call "user_photos" permission to get photo info.

这篇关于Facebook发布与图像(object_attachment)。图片是空的。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆