module Integrity module Helpers module Gravatar def gravatar_attrs(author, size=40) # size = 40 unless %w(20 30 40 50).include?(size) if author.email.nil? {:src => "gravatar-#{size}.png", :title => 'Unknown author'} else email_digest = Digest::MD5.hexdigest(author.email) source = "http://gravatar.com/avatar/#{email_digest}?s=#{size}" {:src => source, :title => author.name} end end end end end