diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d8470392d..bf0943c50 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -43,7 +43,20 @@ module ApplicationHelper # Falls back to Gravatar # def avatar_uri(member, size = 150) - return member.preferred_avatar_uri if member.preferred_avatar_uri.present? + if member.preferred_avatar_uri.present? + # Some avatars support different sizes + # http://graph.facebook.com/12345678/picture?width=150&height=150 + uri = URI.parse(member.preferred_avatar_uri) + + if uri.host == 'graph.facebook.com' + uri.query = "&width=#{size}&height=#{size}" + end + + # TODO: Assess twitter - https://dev.twitter.com/overview/general/user-profile-images-and-banners + # TODO: Assess flickr - https://www.flickr.com/services/api/misc.buddyicons.html + + return uri.to_s + end Gravatar.new(member.email).image_url({ :size => size,