Add avatars to accounts and teams?
I'm looking to add avatars to accounts and teams.
I was thinking of modifying the avatar_url_for in application_helper to be a little more flexible, something like,
I was thinking of modifying the avatar_url_for in application_helper to be a little more flexible, something like,
def avatar_url_for(resource, opts={}) size = opts[:size] || 48 if resource.respond_to?(:avatar) && resource.avatar.attached? && resource.avatar.variable? resource.avatar.variant(combine_options: { }) else if resource.is_a? User hash = Digest::MD5.hexdigest(user.email.downcase) "https://secure.gravatar.com/avatar/#{hash}.png?height=#{size}&width=#{size}" else # some default image end end
Then in Account and Team I'd add ``` has_one_attached :avatar ```
Does this make sense? Anything else I'd need to add to make avatars work for Accounts and Teams?
Does this make sense? Anything else I'd need to add to make avatars work for Accounts and Teams?
Notifications
You’re not receiving notifications from this thread.