Review 13.4 Merged

90315[BUGFIX] Handle oversights in thumbnail web component

Andreas Kienast CR +2 V +2 Normal +37 −35 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
  • Verified V +2 Done
    • Andreas Kienast +2
    • core-ci +1 CI

Issues 2

Files 15

Review log 34

  1. Andreas Kienast commented on patch set 1 08/11/25, 12:46

    Cherry Picked from branch main.
  2. core-ci voted on patch set 1 V +1 08/11/25, 12:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83142

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

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