Skip to content

Commit

Permalink
Resize avatars to fit
Browse files Browse the repository at this point in the history
Rather than serving potentially really big avatars, resize them to fit
in the indicated avatar size.
  • Loading branch information
Taeir committed Sep 3, 2022
1 parent 879040d commit c0d9814
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/helpers/users_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def avatar_url(user, size = 16)
if deleted_user?(user)
user_auto_avatar_url(letter: 'X', color: '#E73737FF', size: size, format: :png)
elsif user&.avatar&.attached?
uploaded_url(user.avatar.blob.key)
url_for(user.avatar.variant(resize_to_fit: [size, size]).processed)
else
user_auto_avatar_url(user, size: size, format: :png)
end
Expand Down

0 comments on commit c0d9814

Please sign in to comment.