4 def user_image(user, options = {})
5 options[:class] ||= "user_image"
7 if user.image_use_gravatar
8 user_gravatar_tag(user, options)
10 image_tag user.image.url(:large), options
14 def user_thumbnail(user, options = {})
15 options[:class] ||= "user_thumbnail"
17 if user.image_use_gravatar
18 user_gravatar_tag(user, options)
20 image_tag user.image.url(:small), options
24 def user_thumbnail_tiny(user, options = {})
25 options[:class] ||= "user_thumbnail_tiny"
27 if user.image_use_gravatar
28 user_gravatar_tag(user, options)
30 image_tag user.image.url(:small), options
34 def user_image_url(user, options = {})
35 if user.image_use_gravatar
36 user_gravatar_url(user, options)
38 "http://#{SERVER_URL}#{image_path(user.image.url)}"
45 image_tag "openid_small.png", :alt => t('user.login.openid_logo_alt'), :class => "openid_logo"
48 def openid_button(name, url)
50 image_tag("#{name}.png", :alt => t("user.login.openid_providers.#{name}.alt")),
52 :class => "openid_button", :data => { :url => url },
53 :title => t("user.login.openid_providers.#{name}.title")
59 # See http://en.gravatar.com/site/implement/images/ for details.
60 def user_gravatar_url(user, options = {})
61 size = options[:size] || 100
62 hash = Digest::MD5::hexdigest(user.email.downcase)
63 default_image_url = "http://#{SERVER_URL}#{image_path("users/images/large.png")}"
64 url = "http://www.gravatar.com/avatar/#{hash}.jpg?s=#{size}&d=#{u(default_image_url)}"
67 def user_gravatar_tag(user, options = {})
68 url = user_gravatar_url(user, options)
70 image_tag url, options