Graph API 获取照片方块 (100x100) [英] Graph API get photo square (100x100)

查看:15
本文介绍了Graph API 获取照片方块 (100x100)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用选择视图用户集获取 facebook 照片(如果他们使用大图像).如果我在路径图中使用 type = "large" 或 "normal" 或 "small" 然后我得到图像,但它不是正方形,也不是用户集的选择视图.那么,如何获得方形照片及其用户集视图

How can I get facebook photo with selection view user set (if they use large image). If I use type = "large" or "normal" or "small" in path graph then I get image but It's not square and It's not selection view of user set. So, how can I get photo with square type and it's view of user set

推荐答案

你可以得到一张比普通的 type=square 尺寸更高的正方形图片(只有 50x50 像素的大小)) 通过请求设置了 widthheight 参数的图片.

You can get a square picture of higher dimensions than the normal one for type=square (which will be only 50x50 pixels in size) by requesting a picture with widthand height parameters set.

参见 https://developers.facebook.com/docs/reference/api/用户/,图片"连接,引用:

See https://developers.facebook.com/docs/reference/api/user/, "picture" connection, quote:

此外,您可以指定宽度和高度 URL 参数来请求特定尺寸的图片.这将返回一个可用的个人资料图片最接近要求的尺寸和要求的纵横比.[...] 如果宽度=高度,我们将始终返回一个方形图片."

"Additionally, you can specify width and height URL parameters to request a picture of a specific size. This will return an available profile picture closest to the requested size and requested aspect ratio. […] if width=height, we will always return a square picture."

示例:

https://graph.facebook.com/4/picture?type=square – 扎克伯格先生的普通"方形头像,尺寸 50x50

https://graph.facebook.com/4/picture?type=square – Mr Zuckerberg’s "normal" square profile pic, size 50x50

https://graph.facebook.com/4/picture?width=100&height=100 – 100x100 像素,完美匹配所要求的尺寸

https://graph.facebook.com/4/picture?width=100&height=100 – 100x100 pixels, perfect match for requested size

https://graph.facebook.com/4/picture?width=150&height=150 - 要求 150x150,得到 156x156.

https://graph.facebook.com/4/picture?width=150&height=150 – asking for 150x150, getting 156x156 instead.

如果您可以忍受有时获得的图像可能比请求的尺寸大一点(或小一点),那应该没问题.

If you can live with maybe sometimes getting images that might be a little bigger (or smaller) then the requested size, you should be fine.

否则,需要进行一些测试才能确定 Facebook 是否总是有货"并提供完全匹配的特定方形图像尺寸,或者每个用户的图像尺寸是否会因用户的不同而有所不同已上传.

Otherwise it’ll take some testing to try and figure out if there are certain square image sizes that Facebook will always have "in stock" and deliver exact matches for, or if it might differ for every user depending on the picture they uploaded.

这篇关于Graph API 获取照片方块 (100x100)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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