Twitter、Facebook - 有没有办法获得头像的原始图像?
通过 RoR gem OmniAuth 可以获得有关通过 Twitter 或 Facebook 帐户登录应用程序的用户的信息。这两个社交网站的 API 都提供了头像,这很棒。 更糟糕的是,图像的大小是 50x50px(我知道,头像)。
存在任何方式,如何获得原始图像,从中创建头像? (我想要它的原因是,我想以更大的尺寸显示用户的照片)
Through RoR gem OmniAuth is possible to get an informations about the users, who log-in to the application through their Twitter or Facebook account. Both of these social sites in their API offers among other also the avatar, what's great.
The worse thing is, that the size of image is 50x50px (I know, avatar).
Exist any way, how to get the original image, from that was created avatar? (The reason why I want it is, that I would like to display a photo of user in the bigger size)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
两个选项:
/${USER_ID}/picture?type=large
;响应是 302 重定向,因此您可以从响应标头获取 url。有关type< 的其他值,请参阅 User 对象 的文档/代码>。 (与文档相反,它看起来需要访问令牌。)这不会为您提供特别大的图像。
/${USER_ID}/albums
并查找带有type=profile
的相册。使用/${ALBUM_ID}/photos
获取此相册中的照片:我认为第一张照片是当前头像(适合我),并且有更多尺寸可供选择比第一种方法。Two options:
/${USER_ID}/picture?type=large
; the response is a 302 redirect so you can obtain the url from the response header. See the docs for the User object for other values fortype
. (Contrary to the docs it looks like an access token is required.) This doesn't get you a particularly large image./${USER_ID}/albums
and find the album withtype=profile
. GET the photos in this album with/${ALBUM_ID}/photos
: I think the first photo is the current avatar (it is for me), and more sizes are available than with the first method.您可以尝试通过电子邮件从 gravatar[1] 获取。
You may try to get from gravatar[1] with email.