Review main Abandoned

90462[POC][TASK] Make LocalCropScaleMaskHelper aware of "forceCreation"

Garvin Hicking CR 0 V 0 Easy +20 −1 updated 09/09/25, 18:02

Commit message

The FAL image processors are executed one after another, with
the LocalImageProcessor often the final task that operates
on a file and resolves execution.

As soon as any processor is successfully processes an image,
the whole processing stack is aborted, so no processor after
that one can further modify a processed file.

That is a bit unfortunate for a case like a watermark processor.

If could prepend itself before LocalImageProcessor and
instantiate all the same helpers and can/process methods
from it, so that all operations are performed with such a
"clone". The Helpers in this case wrap most of the functionality,
and thus it would be nice to be able to re-use them instead
of re-inventing them.

This works, with one exemption: The LocalCropScaleMaskHelper
will not process any file with dimensions requested higher
then the source image. Which usually makes sense, but in this
case, would prevent the watermark service from being able
to create a processedFile variant, as the helper only
returns the "original" image in this case.

The "resize" method used here luckily has an option "forceCreate"
that allows to force exactly what is needed. However,
the LocalCropScaleMaskHelper has no possibility to receive
further parameters from "outside" easily.

This patch solves this situation by adding a "forceCreate"
property to the `$task` object. This property can
be altered by the `setForceCreate()` method of a FAL
processor that clones LocalImageProcessor, so that
the helpers can access it via the `$task->getForceCreate()`
method.

This is a variation of [1] which solves it with distinct
method signature changes.

Alternate solutions to the problem are:

- Introduce PSR-14 event(s) in the LocalImageProcessor
  so that listeners are able to prevent cloning
  LocalImageProcessor at all, and are able to do further
  changes on the processed (or original) file resource.

- Adjust the workflow of FAL processor and actually
  allow to execute further processors AFTER one has
  successfully finished, to still allow changes to
  the output.

[1] https://review.typo3.org/c/Packages/TYPO3.CMS/+/90428

Review

  • Code review CR 0
  • Verified V 0
    • core-ci +1 CI

Issues 1

Files 2

Review log 79

  1. Garvin Hicking uploaded patch set 1 08/20/25, 22:49

  2. core-ci voted on patch set 1 V +1 08/20/25, 22:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83682

  3. Stefan Froemken commented on patch set 1 08/22/25, 09:08

    OK in general. It's POC because of missing tests, right?

    AbstractTask.php:174

    Is there a reason why you name it "state" and not "forceCreation"?
  4. Garvin Hicking commented on patch set 1 08/22/25, 09:32

    Reply

    Yeah, that - and also a general question to Clemens to see if it would work for him, too.

    AbstractTask.php:174 Reply

    "naming things" :) Good idea, will adapt!
  5. Garvin Hicking commented on patch set 2 V +1 08/22/25, 11:24

    Published edit on patch set 1.
  6. Garvin Hicking commented on patch set 2 08/22/25, 11:25

    AbstractTask.php:174 Reply

    Done
  7. core-ci voted on patch set 2 V +1 08/22/25, 11:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83756

  8. Stefan Froemken commented on patch set 2 08/22/25, 11:50

    Reply

    Done
  9. Garvin Hicking abandoned the change 09/09/25, 18:02

    ofher aporoach