Review main Merged Breaking

95956[!!!][FEATURE] Process system resources without FAL persistence

Benni Mack CR +2 V +2 Nightmare +2669 −223 updated 10/08/26, 19:55

Commit message

A system resource shipped inside a package - referenced via an
EXT:/PKG: identifier - can now be resized, cropped and converted
through the same TaskInterface/ProcessorInterface/
FileProcessingService pipeline a FAL file already goes through,
instead of only being processed by first faking a FAL file for it.

The rendered variant is not written to sys_file/
sys_file_processedfile: it is cached under
typo3temp/assets/images/system/, in its own directory per resource,
keyed by that resource's own identifier and a hash of its current
content rather than a database id. A site can therefore use as many
such images, in as many crop/scale variants, as its templates need,
without growing the file storage database by a single row - and the
cache stays correct across a release-based deployment, where the
absolute filesystem path changes on every release regardless of
whether the image itself did.

TaskInterface, AbstractTask, ProcessorInterface, ProcessorRegistry
and FileProcessingService widen to accept either kind of resource
through the same code. A processor has to opt in via the new
ResourceAwareProcessorInterface marker to be offered a non-FAL
task at all; LocalImageProcessor and SvgImageProcessor do, for the
Image.CropScaleMask task. Any task type other than CropScaleMask
remains FAL-only for now.

The <f:image>/<f:uri.image> ViewHelpers use this for an EXT:/PKG:
source instead of the previous compatibility storage, which created
a sys_file_processedfile row - and a matching sys_file-backed
original - for every distinct resource/configuration combination
actually rendered on a site, unboundedly, for any site with a
non-trivial number of templates or crop variants using such images.

TypoScript imgResource does the same, including masks (m.mask,
m.bgImg, ...) that are system resources, for a FAL or a system
resource source alike. imageLinkWrap links such an image to the
tx_cms_showpic eID by its signed resource identifier instead of a
sys_file uid, and ShowImageController resolves it as a public
system resource.

A result that uses the original as-is is recorded in the same cache
directory, so it is not processed again on every call.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Markus Klein +1
    • Simon Praetorius +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Simon Praetorius +1
    • core-ci +1 CI

Issues 1

Files 52

Show 32 more files

Review log 4363

Show 2338 earlier messages
  1. Benni Mack uploaded patch set 1 09/21/26, 01:31

  2. core-ci voted on patch set 1 V -1 09/21/26, 01:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108911

  3. Benni Mack commented on patch set 2 V -1 09/22/26, 06:42

    Published edit on patch set 1.
  4. core-ci voted on patch set 2 V +1 09/22/26, 07:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108970

  5. Benni Mack uploaded patch set 3 V +1 09/22/26, 08:02

  6. Benni Mack updated the commit message in patch set 4 09/22/26, 08:02

  7. core-ci voted on patch set 3 V -1 09/22/26, 08:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108977

  8. core-ci voted on patch set 4 V -1 09/22/26, 08:18 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108978

  9. Benni Mack uploaded patch set 5 V -1 09/22/26, 10:17

  10. Benni Mack updated the commit message in patch set 6 09/22/26, 10:36

  11. core-ci voted on patch set 5 V -1 09/22/26, 10:37 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108988

  12. core-ci voted on patch set 6 V +1 09/22/26, 10:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108993

  13. Benni Mack uploaded patch set 7 V +1 09/22/26, 14:51

  14. Benni Mack marked it ready for review 09/22/26, 14:54

  15. core-ci voted on patch set 7 V -1 09/22/26, 15:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108996

  16. Benni Mack uploaded patch set 8 V -1 09/22/26, 16:50

  17. core-ci voted on patch set 8 V -1 09/22/26, 17:03 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108999

  18. Benni Mack rebased onto patch set 9 V -1 09/22/26, 17:41

  19. core-ci voted on patch set 9 V -1 09/22/26, 17:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109002

  20. Benni Mack rebased onto patch set 10 V -1 09/23/26, 01:44

  21. core-ci voted on patch set 10 V -1 09/23/26, 01:57 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109015

  22. core-ci commented on patch set 10 09/23/26, 03:14 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109015

  23. core-ci voted on patch set 10 V +1 09/23/26, 03:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109015

  24. Simon Schaufelberger commented on patch set 10 09/23/26, 13:29

    ProcessedResourceCache.php:45

    why is this public if it doesn't implement any interface and doesn't have a constructor?

    ResourceStorage.php:1408

    could we add a bit more context about the specific file? that would help for debugging

    ImageService.php:44

    can we add a bit more context about the file?

    ImageViewHelper.php:241

    same here

    ImageViewHelper.php:181

    same here
  25. Benni Mack uploaded patch set 11 V +1 09/23/26, 15:35

  26. Benni Mack commented on patch set 11 09/23/26, 15:40

    ProcessedResourceCache.php:45 Reply

    Done

    ResourceStorage.php:1408 Reply

    Done

    ImageService.php:44 Reply

    Done

    ImageViewHelper.php:241 Reply

    Done

    ImageViewHelper.php:181 Reply

    Done
  27. core-ci voted on patch set 11 V +1 09/23/26, 15:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109071

  28. Benni Mack rebased onto patch set 12 V +1 09/23/26, 16:07

  29. Simon Schaufelberger commented on patch set 12 09/23/26, 16:13

    Awesome, so much better now! Thank you!
  30. Simon Schaufelberger voted on patch set 12 CR +1 09/23/26, 16:13

  31. core-ci voted on patch set 12 V -1 09/23/26, 16:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109085

  32. core-ci voted on patch set 12 V +1 09/23/26, 16:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109085

  33. Simon Praetorius commented on patch set 12 10/01/26, 09:18

    (will look into it later today)
  34. Simon Praetorius commented on patch set 12 10/01/26, 13:05

    ProcessedImageCollector.php:60

    Maybe it makes sense to add `getSize()` to the interface? I'd say that every processed resource should have a size.

    ProcessedImageCollector.php:65

    this could use `$processedFile->getImageDimension()` instead, either to just get the "prepared" values from a proper API or to just store the object directly instead of the individual values.

    ImageResource.php:62

    This could also use `$processedFile->getImageDimension()`

    ImageResource.php:72

    This could also use `$processedFile->getImageDimension()`

    ProcessedResource.php:169

    Maybe we can add `$request` as an optional parameter in the interface, since this method is probably here to stay? Even if the `GU::mI` can be avoided in the future, the request still needs to be provided in some way.

    ProcessedResourceCache.php:82

    `PathUtility::pathinfo()`

    ImageViewHelper.php:74

    ... or resource object
  35. Simon Praetorius commented on patch set 12 10/01/26, 13:11

    ImageViewHelper.php:74 Reply

    Just noticed that that isn't the case... but it should imho. So `ImageSourceResolver` could be extended to also resolve (some?) resource objects. Maybe `StaticResourceInterface` would be the right interface, since it's returned from `<f:resource>`?
  36. Benni Mack uploaded patch set 13 CR +1 V +1 10/02/26, 10:16

  37. Benni Mack commented on patch set 13 10/02/26, 10:17

    ProcessedImageCollector.php:60 Reply

    Done

    ProcessedImageCollector.php:65 Reply

    Done

    ImageResource.php:62 Reply

    Done

    ImageResource.php:72 Reply

    Done

    ProcessedResource.php:169 Reply

    well, if we would add it here, we would need to modify the FileInterface as well (which we could do, but I'd do it separately)

    ProcessedResourceCache.php:82 Reply

    Done
  38. Benni Mack commented on patch set 13 10/02/26, 10:17

    ImageViewHelper.php:74 Reply

    Done
  1. core-ci voted on patch set 13 V +1 10/02/26, 10:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109903

  2. Simon Praetorius commented on patch set 13 CR +1 10/02/26, 10:35

    I'll do some manual tests, hopefully today

    ProcessedResource.php:169 Reply

    Acknowledged
  3. Simon Praetorius commented on patch set 13 10/04/26, 10:11

    I tested several variants of image generation as well as automatic resource deletion, this worked perfectly for me, other than the mentioned relative path.

    ProcessedResource.php:172

    This part doesn't work for me on a site with a path segment as part of its base url (e. g. https://t3coredev.ddev.site/camino/). The images are generated in the correct folder, but `getAbsoluteWebPath` generates a relative web path (`typo3temp/...`), which leads to `/camino/typo3temp/assets/images/system/2555c5da2d684c8237c8794f6c1f989b/5f4d1598a7-328adef80b7e72303cac81e25b38d61e.svg` being resolved by the browser. Maybe everything should go through the resource API? Works: ``` <f:image image="{f:resource(identifier: 'EXT:theme_camino/Resources/Public/Icons/Extension.svg')}" width="300c" height="300c" /> ``` Doesn't work: ``` <f:image src="EXT:theme_camino/Resources/Public/Icons/Extension.svg" width="400c" height="300c" /> ```
  4. Benni Mack uploaded patch set 14 CR +1 V +1 10/05/26, 18:28

  5. Benni Mack commented on patch set 14 10/05/26, 18:29

    ProcessedResource.php:172 Reply

    Thanks, I changed the place and added a quick test with PKG: can you recheck? If not, I will try again and also add a test to the Image VH again
  6. core-ci voted on patch set 14 V +1 10/05/26, 18:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110145

  7. Simon Praetorius commented on patch set 14 CR +1 V +1 10/05/26, 19:31

    Works now as expected. Thanks!
  8. Oli Bartsch commented on patch set 14 10/05/26, 20:53

    This seems to be wrong.
  9. Benni Mack uploaded patch set 15 CR +1 V +1 10/06/26, 07:13

  10. Benni Mack updated the commit message in patch set 16 10/06/26, 07:14

  11. Benni Mack commented on patch set 16 10/06/26, 07:14

    This change is ready for review.

    Reply

    Done

    ProcessedResource.php:172 Reply

    Done
  12. core-ci voted on patch set 15 V -1 10/06/26, 07:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110193

  13. core-ci voted on patch set 16 V -1 10/06/26, 07:25 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110194

  14. Benni Mack commented on patch set 17 V -1 10/06/26, 07:39

    Published edit on patch set 16.
  15. core-ci voted on patch set 17 V +1 10/06/26, 07:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110198

  16. Markus Klein commented on patch set 17 10/06/26, 07:55

    I'm not sure about the `typo3temp/` path. We never "share" this during releases currently. I would rather see this in `var/..`
  17. Benni Mack commented on patch set 17 10/06/26, 07:59

    Reply

    what exactly do you mean? processed resources are put into typo3temp/assets/ - this is where e.g. FAL zero Storage puts its images as well (typo3temp/assets/_processed). Putting the files in var/ (typo3temp/var in classic mode setups) does not allow direct access to these processed resources in composer mode based setups
  18. Markus Klein commented on patch set 17 10/06/26, 08:03

    Reply

    Yeah... forget it. Wrong thought on my side. Thanks.
  19. Markus Klein commented on patch set 17 10/06/26, 08:18

    ImageSourceResolver.php:50

    can we narrow that a bit instead of object?

    ProcessedResource.php:187

    request as parameter an fallback to global?
  20. Benni Mack commented on patch set 17 10/06/26, 09:15

    ProcessedResource.php:187 Reply

    we discussed this in an earlier patch set - this would be a breaking change (as it also needs to be adapted in Fileinterface), which I want to do this in followup.
  21. Markus Klein commented on patch set 17 CR +1 10/06/26, 11:54

    ProcessedResource.php:187 Reply

    Acknowledged
  22. Oli Bartsch commented on patch set 17 CR +1 V +1 10/07/26, 06:57

    ImageSourceResolver.php:50 Reply

    I'd keep object here on purpose. It matches ResourceFactory::resolveFileObject(), which this delegates to, and the image argument of both image ViewHelpers is a plain object. With a narrowed union type, a wrong object from a template would become a TypeError. That skips the ViewHelper's catch, so instead of the Fluid exception with template context you'd get a fatal. The accepted types are listed in the class docblock anyways.
  23. Simon Praetorius voted on patch set 17 CR +1 V +1 10/08/26, 16:44

  24. Benni Mack commented on patch set 17 CR +2 V +2 10/08/26, 19:55

    ImageSourceResolver.php:50 Reply

    Done
  25. Benni Mack merged patch set 18 10/08/26, 19:55