我在设计中使用 mongoid、rails 3.2.10 和omniauth .. 并尝试设置facebook 个人资料图片网址的自定义image_size
config.omniauth :facebook , API_KEYS['facebook']['api_key'], API_KEYS['facebook']['api_secret'], :image_size => {:width => 100, :height => 100}
我配置如上..但结果如下..
http://graph.facebook.com/636937446/picture?type=#<OmniAuth::Strategy::Options height=100 width=100>
所以我检查了 facebook-omniauth Strategy.rb 文件。请告诉我该怎么办..
def image_url uid, options
uri_class = options[:secure_image_url] ? URI::HTTPS : URI::HTTP
url = uri_class.build({:host => 'graph.facebook.com', :path => "/#{uid}/picture"})
query = if options[:image_size].is_a?(String)
{ :type => options[:image_size] }
elsif options[:image_size].is_a?(Hash)
options[:image_size]
end
url.query = Rack::Utils.build_query(query) if query
url.to_s
end