Get redirect of a URL in Ruby

后端 未结 7 1277
盖世英雄少女心
盖世英雄少女心 2020-12-02 23:18

According to Facebook graph API we can request a user profile picture with this (example):

https://graph.facebook.com/1489686594/picture

Bu

7条回答
  •  萌比男神i
    2020-12-02 23:42

    Yeah, "Location" response header tell you the actual image URL.

    However, if you use the picture as the user's profile image on your site, I recommend you to use "https://graph.facebook.com/:user_id/picture" style URL instead of actual image URL. Otherwise, your users will see lots of "not found" images, or outdated profile images in the future.

    You just put "https://graph.facebook.com/:user_id/picture" as the "src" attribute of "img" tag. They browser gets the updated image of the user.

    ps. I have such troubles on my site with Twitter & Yahoo! OpenID now..

提交回复
热议问题