Review main Merged

90184[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
    • Garvin Hicking +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Andreas Kienast +2
    • Garvin Hicking +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 2

Files 15

Review log 1317

  1. Andreas Kienast uploaded patch set 1 07/29/25, 07:53

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

  3. Andreas Kienast voted on patch set 1 CR -1 07/29/25, 13:31

  4. Andreas Kienast uploaded patch set 2 CR -1 V +1 07/29/25, 14:02

  5. Andreas Kienast uploaded patch set 3 07/29/25, 14:04

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

  7. core-ci voted on patch set 3 V +1 07/29/25, 14:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82499

  8. Markus Klein commented on patch set 3 CR +1 07/29/25, 14:44

    will test on v12 again
  9. Markus Klein voted on patch set 3 V +1 07/29/25, 16:53

  10. Garvin Hicking voted on patch set 3 CR +1 V +1 08/05/25, 06:18

  11. Simon Schaufelberger voted on patch set 3 CR +1 V +1 08/05/25, 08:25

  12. Andreas Kienast rebased onto patch set 4 CR +1 V +1 08/05/25, 12:23

  13. core-ci voted on patch set 4 V +1 08/05/25, 12:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82805

  14. Garvin Hicking voted on patch set 4 CR +1 V +1 08/05/25, 15:35

  15. Simon Schaufelberger voted on patch set 4 CR +1 V +1 08/06/25, 20:01

  16. Andreas Kienast voted on patch set 4 CR +2 V +2 08/11/25, 12:46

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