问题obtaing资料图片来自Facebook的图形API [英] Problem obtaing profile pictures from Facebook Graph API

查看:191
本文介绍了问题obtaing资料图片来自Facebook的图形API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿! 已经得到到位的基础上,但现在,找到自己想要玩弄我的
应用程序的用户的个人资料图片;我很为难....而且已经有一段时间...

Hey! Have gotten the foundation in place, but now, finding myself wanting to play around with my
application's user's profile pictures; I'm stumped....and have been for quite some hours...

首先,我oauth_token / access_token获得,使用官方(虽然阿尔法;-)
的Facebook C#SDK 并仅利用的图形API

Firstly, my oauth_token / access_token is obtained, using the official (though Alpha ;-)
Facebook C# SDK and only utilize the Graph API.

FBapi 的获得(/+ friend.Dictionary [身份证]字符串+/图片。);

FBapi.Get("/" + friend.Dictionary["id"].String + "/picture");

将导致一个例外,由于没有返回的JSONObject,以及

leads to an exception due to not returning a JSONObject, and

使用完整的 http://graph.facebook.com/me/picture 转发/转换为图像的URL。

using the complete http://graph.facebook.com/me/picture is forwarded/translated to the image's URL.

尝试一个更直接的方法没有成功之一:

Trying a more direct approach didn't pan out either :

Web客户端wcImg =新的Web客户端();

WebClient wcImg = new WebClient();

wcImg.DownloadFile(/+ friend.Dictionary [身份证]字符串+/图片,​​name_blame.jpg。);

wcImg.DownloadFile("/" + friend.Dictionary["id"].String + "/picture", "name_blame.jpg");

一些细节缺乏在我的问题;对不起,我很累,而且会在以后编辑,如果沸沸扬扬开始。

Some details are lacking in my question; I beg your pardon, am very tired and will edit later if uproar commences.

想法?


附录: 男孩,患有由code盲目性我确实是!然而,你的感觉给了我什么,我需要(Zynga的,颤抖我的画布;-)。

Ideas?


Addendum : Boy, afflicted by code blindness I was indeed! However, your sensibility gave me what I needed (Zynga, tremble in my canvas ;-).

有关为了好奇......似乎没有JSON模板(原谅我缺乏行话)可供用户照片?那你怎么一去获取一个充实,图形API照片的资料图片(如果可用)?

For sake of curiosity...it appears there's no JSON template(pardon my lack of lingo) available for profile pictures? Then how do one go about obtaining a fleshed out, Graph API Photo of that profile picture (if available)?

推荐答案

在图形API的图片是一个比较特殊的动物。它不返回JSON,它直接转发到图像。有人作了这样就可以使用这个网址就在HTML:

The picture in Graph API is a bit special animal. It doesn't return json, it directly forwards to the image. It was made so that you can use this url right in html:

<img src="http://graph.facebook.com/<UID>/picture"> - displays avatar

现在,如果你需要知道它重定向到实际的图片网址有2个选择:

Now if you need to know actual picture URL it redirects to there are 2 options:

  1. 阅读从图中URL重定向头。
  2. 使用FQL:

  1. Read redirect headers from that graph URL.
  2. Use FQL:

select pic_square from user where uid=12345

还有很多其他的方式可以提取有关使用FQL(包括其他尺寸的图片),你可以看到什么是用户表中的这里

There is alot of other info that can be extracted about a user using FQL (including pictures in other sizes), you can view what's inside user table here.

这篇关于问题obtaing资料图片来自Facebook的图形API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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