4 def user_image(user, options = {})
5 options[:class] ||= "user_image"
8 if user.image_use_gravatar
9 user_gravatar_tag(user, options)
11 image_tag user.image.url(:large), options
15 def user_thumbnail(user, options = {})
16 options[:class] ||= "user_thumbnail"
19 if user.image_use_gravatar
20 user_gravatar_tag(user, options)
22 image_tag user.image.url(:small), options
26 def user_thumbnail_tiny(user, options = {})
27 options[:class] ||= "user_thumbnail_tiny"
30 if user.image_use_gravatar
31 user_gravatar_tag(user, options)
33 image_tag user.image.url(:small), options
37 def user_image_url(user, options = {})
38 if user.image_use_gravatar
39 user_gravatar_url(user, options)
41 image_url(user.image.url)
48 image_tag "openid_small.png", :alt => t("user.login.openid_logo_alt"), :class => "openid_logo"
51 def openid_button(name, url)
53 image_tag("#{name}.png", :alt => t("user.login.openid_providers.#{name}.alt")),
54 auth_path(:provider => "openid", :openid_url => url),
55 :class => "openid_button",
56 :title => t("user.login.openid_providers.#{name}.title")
62 # See http://en.gravatar.com/site/implement/images/ for details.
63 def user_gravatar_url(user, options = {})
64 size = options[:size] || 100
65 hash = Digest::MD5.hexdigest(user.email.downcase)
66 default_image_url = image_url("users/images/large.png")
67 "#{request.protocol}www.gravatar.com/avatar/#{hash}.jpg?s=#{size}&d=#{u(default_image_url)}"
70 def user_gravatar_tag(user, options = {})
71 url = user_gravatar_url(user, options)
73 image_tag url, options