简体   繁体   English

Twitter,Facebook-有没有办法获得化身的原始图像?

[英]Twitter, Facebook - is there any way to get the original images of avatars?

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. 通过RoR gem,OmniAuth可以获取有关用户的信息,这些用户通过其Twitter或Facebook帐户登录到该应用程序。 Both of these social sites in their API offers among other also the avatar, what's great. 这些API中的这两个社交网站都提供了头像,这非常棒。 The worse thing is, that the size of image is 50x50px (I know, avatar). 更糟糕的是,图像的大小是50x50px(我知道,头像)。

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) (我想要它的原因是,我想以更大的尺寸显示用户的照片)

Two options: 两种选择:

  1. GET /${USER_ID}/picture?type=large ; GET /${USER_ID}/picture?type=large ; the response is a 302 redirect so you can obtain the url from the response header. 响应是302重定向,因此您可以从响应标头中获取网址。 See the docs for the User object for other values for type . 有关type其他值,请参阅用户对象的文档。 (Contrary to the docs it looks like an access token is required.) This doesn't get you a particularly large image. (与文档相反,它看起来是必需的访问令牌。)这并不会为您带来特别大的图像。
  2. GET /${USER_ID}/albums and find the album with type=profile . 获取/${USER_ID}/albums然后找到带有type=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. 使用/${ALBUM_ID}/photos获取此相册中的/${ALBUM_ID}/photos :我认为第一张照片是当前头像(对我来说),并且比第一种方法有更多尺寸。

You may try to get from gravatar[1] with email. 您可以尝试通过电子邮件从gravatar [1]获取信息。

  1. http://en.gravatar.com/site/implement http://en.gravatar.com/site/implement

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

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