Review main Merged Breaking

90532[!!!][TASK] Remove LocalPreviewHelper and LocalCropScaleMaskHelper

Benni Mack CR +2 V +2 Hard +356 −505 updated 09/10/25, 14:56

Commit message

The helper classes for Preview and CropScaleMask (CSM)
for generating images have been always a thorn when
cleaning up the API.

This change now merges them into the LocalImageProcessor,
the OnlineMediaProcessor now inherits from the
LocalImageProcessor.

This change is breaking as the Helper classes were never
internal (which they should have been) and the new methods
are now protected, and moved into the LocalImageProcessor.

Tests for `LocalImagePreviewHelper` are removed to be covered
in favor of functional tests. `ImageViewHelperTest` covers
default and noUpscale tests. The one remaining `LocalImageHelper`
test covered width=0/height=0 images introduced in TYPO3 < 7
for PDF files that had no thumbnail dimension. This is since
replaced by also PDF `sys_file_metadata` entry having dimensions
assigned, and need to specific unit testing anymore.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Garvin Hicking +1
    • Stefan Bürk +1
  • Verified V +2 Done
    • Benni Mack +2
    • Garvin Hicking +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 8

Review log 2534

Show 69 earlier messages
  1. Benni Mack uploaded patch set 1 09/01/25, 15:05

  2. core-ci voted on patch set 1 V -1 09/01/25, 15:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84167

  3. C. Gogolin commented on patch set 1 09/03/25, 05:04

    Fewer classes are more... 👍

    LocalImageProcessor.php:361

    Wouldn't it make sense if the file names weren't derived directly from the task type and task name?
  4. Garvin Hicking commented on patch set 1 09/05/25, 11:52

    (Review note: I compared all moved methods; at this point no changes are made in any of the methods body, that makes reviewing easier to know ;)

    LocalImageProcessor.php:361 Reply

    I would say this isn't needed because only the "Preview" task actually calls this method. Anything other than "Preview" and "CropScaleMask" isn't supported (yet) by this, and each calls their own file helper methods. I would say we leave it like this and can do later refactoring once more types would get implemented, but for now this would make review easier to keep differences in moving these methods out.
  5. Garvin Hicking commented on patch set 1 CR -1 09/05/25, 11:53

    On it to address CI/tests.
  6. Garvin Hicking uploaded patch set 2 CR -1 V -1 09/05/25, 12:54

  7. core-ci voted on patch set 2 V -1 09/05/25, 13:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84467

  8. Garvin Hicking uploaded patch set 3 V -1 09/05/25, 13:32

  9. core-ci voted on patch set 3 V +1 09/05/25, 13:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84469

  1. Garvin Hicking commented on patch set 3 09/05/25, 13:42

    Reply

    Done for today; waiting for feedback whether we can move the unit test to the functional, and what needs coverage. Technically the new process seems to work well, I did not find any issues yet.
  2. Garvin Hicking updated the commit message in patch set 4 V +1 09/05/25, 14:30

  3. core-ci voted on patch set 4 V +1 09/05/25, 14:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84474

  4. Garvin Hicking updated the commit message in patch set 5 V +1 09/05/25, 14:43

  5. Garvin Hicking uploaded patch set 6 09/05/25, 14:44

  6. Garvin Hicking commented on patch set 6 V +1 09/05/25, 14:45

    The RST may need some more love, unsure if that's sufficient? Otherwise: Seems to work well! :)
  7. core-ci voted on patch set 5 V +1 09/05/25, 14:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84477

  8. core-ci voted on patch set 6 V +1 09/05/25, 14:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84478

  9. Benni Mack uploaded patch set 7 V +1 09/08/25, 09:13

  10. Benni Mack commented on patch set 7 CR +1 09/08/25, 09:14

    Reply

    Done
  11. Benni Mack updated the commit message in patch set 8 CR +1 09/08/25, 09:14

  12. core-ci voted on patch set 7 V +1 09/08/25, 09:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84612

  13. core-ci voted on patch set 8 V +1 09/08/25, 09:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84613

  14. Markus Klein commented on patch set 8 09/08/25, 10:01

    LocalImageProcessor.php:67

    can we take the chance to introduce constants for those strings?
  15. Benni Mack commented on patch set 8 09/08/25, 11:08

    LocalImageProcessor.php:67 Reply

    in an ideal world, we can merge Preview + CSM soon
  16. Markus Klein commented on patch set 8 09/08/25, 11:08

    LocalImageProcessor.php:67 Reply

    😇
  17. Garvin Hicking voted on patch set 8 CR +1 V +1 09/08/25, 11:33

  18. Garvin Hicking commented on patch set 8 V 0 CR -1 09/08/25, 14:30

    Hang on, we should add the removed classes to the extension scanner.
  19. C. Gogolin commented on patch set 8 09/08/25, 17:46

    LocalImageProcessor.php:67 Reply

    Using constants or enums in this spot, I think, is a good idea. @benni@typo3.org BUT: Correct me if I'm wrong, but the preview is not used in the front end. In other words, if you handle the CSM processor you focus on the front-end output. If you were to combine preview and CSM, the image's intent would no longer be recognizable and synchronizing front end and back end is not always desirable.

    LocalImageProcessor.php:177

    Can you add: This method returns the original file when the requested size is greater than or equal to the original image, since enlarging it is generally not advantageous.

    Breaking-107403-RemoveLocalPreviewHelperAndLocalCropScaleMaskHelper.rst:52

    Is that a preemptive move regarding my revision? Because at the moment you can't really start your own processor 'afterwards' if the previous one already snatches the job away from you." See https://review.typo3.org/c/Packages/TYPO3.CMS/+/90428
  20. Garvin Hicking uploaded patch set 9 CR -1 V +1 09/10/25, 12:37

  21. Garvin Hicking commented on patch set 9 CR +1 V +1 09/10/25, 12:38

    Reply

    Done

    LocalImageProcessor.php:177 Reply

    I've slightly rephrased this and hope this covers it properly.

    Breaking-107403-RemoveLocalPreviewHelperAndLocalCropScaleMaskHelper.rst:52 Reply

    Indeed I was getting ahead of myself. For now I've removed the "after" thing. When we implement the Chainable/Stackable Interface, we can adjust this changelog.
  22. core-ci voted on patch set 9 V +1 09/10/25, 12:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84775

  23. Stefan Bürk voted on patch set 9 CR +1 V +1 09/10/25, 14:43

  24. Benni Mack voted on patch set 9 CR +2 V +2 09/10/25, 14:56

  25. Benni Mack merged patch set 10 09/10/25, 14:56