大頭照預設大小有四種
http://graph.facebook.com/id/picture?type=small
http://graph.facebook.com/id/picture?type=square
http://graph.facebook.com/id/picture?type=large
http://graph.facebook.com/id/picture?type=normal
預設都是抓取 square, 但是不論放在手機或是網頁上~ 根本就是8bit時代的產物
所以在抓取檔案時要指定large (200x200)
手機API部分 :
在app/model/user.rb,在picture加上 .type(large)
res = RestClient.get "https://graph.facebook.com/v2.4/me", { :params => { :fields => "email,name,gender,picture.type(large)", :access_token => access_token } }
OmniAuth 部分:在config/initializers/devise.rb 之中 加上 :image_size => 'large'
config.omniauth :facebook, fb_config["facebook"]["app_id"], fb_config["facebook"]["secret"], :scope => 'public_profile,email', :info_fields => 'name,gender,email', :image_size => 'large'
對! 這樣就結束了...
0 意見:
張貼留言