Defect #26379

Fix thumbnail rendering for images with height >> width

Added by Gabriel Cardoso 20 days ago. Updated 11 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Attachments
Target version:3.4.2
Resolution:Fixed Affected version:3.4.0

Description

The ImageMagick format rule being `100x100>` (given 100 as thumbnail size in settings), when uploading images with a height much greater than the width (like websites templates) the thumbnail will have a height of 100px and a computed width so homothety is respected.

In the `thumbnail_tag` helper from `ApplicationHelper`, the width attribute is set width `Setting.thumbnails_size`. I suggest to remove this attribute from the image tag since the source thumbnail has the right size.

Am I missing some cases where this change could have an important impact ?

very high image example.jpg (89.6 KB) Gabriel Cardoso, 2017-07-07 12:02

26379-3_3@2x.png (15.7 KB) Go MAEDA, 2017-07-08 10:17

26379-3_4@2x.png (64.6 KB) Go MAEDA, 2017-07-08 10:17

defect-26379.diff Magnifier (775 Bytes) Go MAEDA, 2017-07-09 08:37

Associated revisions

Revision 16813
Added by Jean-Philippe Lang 17 days ago

Fix thumbnail rendering for images with height >> width.

History

#1 Updated by Pavel Rosick√Ĺ 20 days ago

you can disable imagemagick and then you won't be able to resize thumbnails

bundle install --without rmagick

#2 Updated by Go MAEDA 19 days ago

Gabriel Cardoso wrote:

In the `thumbnail_tag` helper from `ApplicationHelper`, the width attribute is set width `Setting.thumbnails_size`. I suggest to remove this attribute from the image tag since the source thumbnail has the right size.

The width attribute is workaround for strange behavior of Firefox. Please see #24927#note-6 and #24927#note-8 for details.

#3 Updated by Go MAEDA 19 days ago

  • Tracker changed from Patch to Defect
  • Affected version set to 3.4.0

#4 Updated by Go MAEDA 19 days ago

Redmine 3.3 (displayed with 25px * 100px):

Redmine 3.4 (displayed with 100px * 392px):

#5 Updated by Go MAEDA 18 days ago

Here is a patch to fix this issue.
Thumbnails are displayed in the same way as in Redmine 3.3 if the patch applied.

#6 Updated by Jean-Philippe Lang 18 days ago

  • Target version changed from 3.4.1 to 3.4.2

Waiting for some feedback before merging it.

#7 Updated by Gabriel Cardoso 17 days ago

  • Status changed from New to Resolved

Perfect ! Thank you !

Indeed, your approach is better and solve the proble. Hope it doesn't break #24927#note-6 and #24927#note-8 on Firefox

#8 Updated by Go MAEDA 17 days ago

  • Status changed from Resolved to Confirmed

Gabriel Cardoso wrote:

Indeed, your approach is better and solve the proble. Hope it doesn't break #24927#note-6 and #24927#note-8 on Firefox

No problem. Setting both max-width and max-height resolved #24927#note-6.
Thank you for your feedback!


"Resolved" status is used by core developers, I am setting the status to "Confirmed".

#9 Updated by Jean-Philippe Lang 17 days ago

  • Subject changed from Fix thumbnail rendering to Fix thumbnail rendering for images with height >> width
  • Status changed from Confirmed to Resolved
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Patch committed, thanks.

#10 Updated by Jean-Philippe Lang 11 days ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF