简体   繁体   English

Facebook个人资料图片大

[英]Facebook Profile Picture Large

I am having trouble trying to request the large version of the users profile picture on Facebook.. in my graph path I'm doing: 我在尝试在我的图形路径中尝试在Facebook上请求大版本的用户个人资料图片时遇到麻烦。

NSString *requestPath = @"me/?fields=first_name,last_name,gender,email,birthday,verified,picture";

The picture field in there only gives me the small version of the profile picture, but i need the large and the normal version.. i already tried changing picture to picture_large, pic_large, image_large but none of this works.. 那里的图片字段只给了我个人资料图片的小版本,但我需要大版本和普通版本。.我已经尝试过将图片更改为picture_large,pic_large,image_large,但这些都不起作用。

Please, i already read the documentations, so don't bother answering if you plan on telling me to read it again.. I'm asking this here because i already searched everywhere and couldn't find a solution. 请,我已经阅读了文档,所以如果您打算告诉我再次阅读它,请不要打扰。.我在这里问这个问题是因为我已经到处搜索并且找不到解决方案。

Thanks, Newton 谢谢,牛顿

The short answer you are looking for is picture.type(large) 您正在寻找的简短答案是picture.type(large)

I was looking for the same thing and found the answer using Facebook Graph API explorer found here . 我一直在寻找相同的东西,并使用此处找到的Facebook Graph API Explorer找到了答案。

Now if I use the following code: 现在,如果我使用以下代码:

[FBRequestConnection startWithGraphPath:@"me"
                             parameters:[NSDictionary dictionaryWithObject:@"picture.type(large),id,email,name,username"
                                                                    forKey:@"fields"]
                             HTTPMethod:@"GET"
                      completionHandler:^(FBRequestConnection *connection, id result, NSError *error){[self fbRequestCompleted:result];}];

the "picture" key in the "result" dictionary has the value of the large picture's URL. “结果”字典中的“图片”键具有大图片URL的值。

You can just use: 您可以使用:

http://graph.facebook.com/USER/picture?type=large

Where USER can be either the user id or the user name. 其中USER可以是用户ID或用户名。

That returns a redirect to the static image url, as written in the User object documentation : 用户对象文档中所述,这将返回到静态图像URL的重定向:

HTTP 302 redirect to URL of the user's profile picture (use ?type=square | small | normal | large to request a different photo). HTTP 302重定向到用户个人资料图片的URL(使用?type = square | small | normal | large请求其他图片)。

Nitzan Tomer's response is still correct for iOS; Nitzan Tomer对于iOS仍然是正确的; if you want to get the large version of the user's profile picture using Facebook's iOS API, you can just write: 如果您想使用Facebook的iOS API获取用户个人资料图片的大版本,则可以编写:

    [facebook requestWithGraphPath:@"me/picture" andParams:[NSMutableDictionary dictionaryWithObject:@"large" forKey:@"type"] andDelegate:self];

And you will get the image data in the result object, in this delegate method: 然后,您可以通过以下委托方法在结果对象中获取图像数据:

- (void)request:(FBRequest*)request didLoad:(id)result

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM