Project

General

Profile

Defect #44645 ยป 0001-Set-width-and-height-on-Gravatar-images-to-avoid-lay.patch

Go MAEDA, 2026-10-20 04:44

View differences:

lib/plugins/gravatar/lib/gravatar.rb
# double the size for hires displays
options[:srcset] = "#{gravatar_url(email, options.merge(size: options[:size].to_i * 2))} 2x"
image_tag src, options.except(:rating, :size, :default, :ssl)
image_tag src, options.except(:rating, :default, :ssl)
end
# Returns the base Gravatar URL for the given email hash
test/helpers/avatars_helper_test.rb
def test_avatar_with_size_option
assert_include 'size=24', avatar('jsmith <jsmith@somenet.foo>', :size => 24)
assert_include 'width="24" height="24"', avatar('jsmith <jsmith@somenet.foo>', :size => 24)
assert_include 'width="24" height="24"', avatar(User.anonymous, :size => 24)
end
    (1-1/1)