Review 12.4 Merged

90194[BUGFIX] Handle oversights in thumbnail web component

Markus Klein CR +2 V +2 Normal +36 −34 updated 08/11/25, 13:24

Commit message

The method `ThumbnailSize::getDimensions()` falsely used plain integer
values when rendering thumbnails in case aspect ratio should be kept.
This caused distorted images as the rendered thumbnail was forced in the
configured dimensions (e.g. 64x64). This commit fixes this by using the
`m` suffix, as documented at [1].

The `width` and `height` attributes should be applied to the rendered
image only if they are passed with a reasonable value. If the arguments
are omitted, they get the value `0` assigned, leading to broken
rendering. The code now checks whether their respective value is larger
than 0 before applying them to the image.

The need to create the URL to the `ResourceController` via PHP is not
necessary, as this implies code duplication when called at other places.
For this reason, the "base URL" is generated on a global level and
passed down as `TYPO3.settings.Resource.thumbnailUrl`.

The `ThumbnailSize` enum was falsely stored in EXT:filelist, creating
an unwanted dependency within EXT:backend. The enum has been moved to a
more appropriate location.

[1] https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Functions/Imgresource.html#width

Review

  • Code review CR +2 Done
    • Andreas Kienast +2
    • Markus Klein +1
  • Verified V +2 Done
    • Andreas Kienast +2
    • Markus Klein +1
    • core-ci +1 CI

Issues 2

Files 15

Review log 45

  1. Markus Klein uploaded patch set 1 07/29/25, 16:45

  2. core-ci voted on patch set 1 V +1 07/29/25, 16:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82503

  3. Markus Klein voted on patch set 1 CR +1 V +1 07/29/25, 16:53

  4. Andreas Kienast voted on patch set 1 CR +2 V +2 08/11/25, 13:24

  5. Andreas Kienast merged patch set 2 08/11/25, 13:24