Project

General

Profile

Patch #37597 ยป generate-hires-thumbnails-only.patch

Go MAEDA, 2022-08-23 08:21

View differences:

app/helpers/application_helper.rb
319 319

  
320 320
  def thumbnail_tag(attachment)
321 321
    thumbnail_size = Setting.thumbnails_size.to_i
322
    physical_thumbnail_size = thumbnail_size * 2
322 323
    link_to(
323 324
      image_tag(
324
        thumbnail_path(attachment),
325
        :srcset => "#{thumbnail_path(attachment, :size => thumbnail_size * 2)} 2x",
325
        thumbnail_path(attachment, :size => physical_thumbnail_size),
326
        :srcset => "#{thumbnail_path(attachment, :size => physical_thumbnail_size)} 2x",
326 327
        :style => "max-width: #{thumbnail_size}px; max-height: #{thumbnail_size}px;",
327 328
        :loading => "lazy"
328 329
      ),
test/helpers/application_helper_test.rb
1886 1886
    assert_select_in(
1887 1887
      thumbnail_tag(a),
1888 1888
      'a[href=?][title=?] img[src=?][loading="lazy"]',
1889
      "/attachments/3", "logo.gif", "/attachments/thumbnail/3")
1889
      "/attachments/3", "logo.gif", "/attachments/thumbnail/3/200")
1890 1890
  end
1891 1891

  
1892 1892
  def test_link_to_project
    (1-1/1)