Facebook图表高分辨率照片 [英] Facebook Graph high resolution photos

查看:228
本文介绍了Facebook图表高分辨率照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我/ home做一个Facebook Graph API调用,以获取用户的新闻提要。众所周知,您在图片字段中获得的网址是一张低分辨率的照片,对于100x100以上的任何内容都不好看。我知道您可以通过对object_id进行另一个图表调用并使用该结果中的source字段来获取高分辨率图片的URL。

I'm doing a Facebook Graph API call for "me/home" to get the user's news feed. As everyone knows, the URL you get in the "picture" field is a low resolution photo that doesn't look good at anything above 100x100. I know you can get the URL to the high resolution picture by doing another graph call for the "object_id" and using the "source" field in that result.

但是我正在查看URL,并认为可能会有一种方式将一个转换为另一个,而不必再做另一个图表调用。 X-例如,第一个URL是低分辨率的,第二个URL是源解析。

But I was looking at the URLs and thought there might be a way to transform one into the other without having to make another graph call. Either that, or construct the high resolution one from existing data in other fields. For example, the first URL is the low resolution one, and the second URL is the source resolution.

http://photos-d.ak.fbcdn.net/hphotos-ak-ash4/297313_10152643117455790_610095553_s.jpg
http://sphotos-b.xx.fbcdn.net/hphotos-ash4/297313_10152643117455790_610095553_n.jpg

看起来数字是(我不知道的东西)_(object_id)_(有别的我不知道)

有人有尝试改变URL的经验,同时仍然保留数字部分在中间?通常可能会导致正则表达式问题的变化?

Has anyone had experience with trying to change out the URLs while still keeping the numerical section in the middle? Are there typically variations that could cause regex problems?

编辑:这是我正在使用的代码。

Here is the code I'm using.

String objectId = null;
if (jsonObject.has("object_id")) {
    objectId = jsonObject.getString("object_id");
}
String postPhoto = "http://graph.facebook.com/" + objectId + "/picture";

检查帖子是否是一张照片,代码稍早一点,所以它会总是运行这些行的一个帖子类型的照片。

The check for if the post is a photo is a little earlier in the code, so it'll always run these lines for a post type of "photo".

推荐答案

我/ home - 图表api有一个名为object_id和type的字段。新新200新新新旗新新旗旗新新旗新新旗新新旗旗新新旗新新旗新新旗新新旗旗新新旗新新200新新新旗新新旗旗新新旗通过使用此对象标识并创建另一个图形API,您将获得一个被称为images的对象。该对象有几个选项(不同大小)。

me/home - graph api has some a field called "object_id" and "type". If the type is "photo" then you will have this object_id value. By Using this object id and make another graph api call then you will get an objecty called "images". This object has several options ( different sizes ).

使用如下所示的对象标识,并获得照片的相册大小版本。新新新新旗新新旗旗新新新200新新新200新新新200新新新200新新新200新新新200新新200新新200新新200新新200新新200新新200新新200新新200新新200新新200新新新200新新2001-新新新200新

Use object id like below and get a album sized version of a photo. and the supported types for this call are "thumbnail, normal, album".

https://graph.facebook.com/{object-id-from-feed}/picture?type=normal 

还可以在支持对象的示例部分。

这篇关于Facebook图表高分辨率照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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