mirror of
https://github.com/meineerde/redmine.git
synced 2026-02-03 23:53:23 +00:00
Don't create two thumbnails of different resolutions for a single image (#37597).
Patch by Go MAEDA. git-svn-id: https://svn.redmine.org/redmine/trunk@21784 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
8d6c82316d
commit
54f281fef9
@ -319,10 +319,11 @@ module ApplicationHelper
|
||||
|
||||
def thumbnail_tag(attachment)
|
||||
thumbnail_size = Setting.thumbnails_size.to_i
|
||||
thumbnail_path = thumbnail_path(attachment, :size => thumbnail_size * 2)
|
||||
link_to(
|
||||
image_tag(
|
||||
thumbnail_path(attachment),
|
||||
:srcset => "#{thumbnail_path(attachment, :size => thumbnail_size * 2)} 2x",
|
||||
thumbnail_path,
|
||||
:srcset => "#{thumbnail_path} 2x",
|
||||
:style => "max-width: #{thumbnail_size}px; max-height: #{thumbnail_size}px;",
|
||||
:loading => "lazy"
|
||||
),
|
||||
|
||||
@ -2756,7 +2756,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
assert_select 'div.thumbnails' do
|
||||
assert_select 'a[href="/attachments/16"]' do
|
||||
assert_select 'img[src="/attachments/thumbnail/16"]'
|
||||
assert_select 'img[src="/attachments/thumbnail/16/200"]'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -1886,7 +1886,7 @@ class ApplicationHelperTest < Redmine::HelperTest
|
||||
assert_select_in(
|
||||
thumbnail_tag(a),
|
||||
'a[href=?][title=?] img[src=?][loading="lazy"]',
|
||||
"/attachments/3", "logo.gif", "/attachments/thumbnail/3")
|
||||
"/attachments/3", "logo.gif", "/attachments/thumbnail/3/200")
|
||||
end
|
||||
|
||||
def test_link_to_project
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user