87336[FEATURE] Allow synchronized manipulation of all crop variants
Commit message
Review
-
Code review CR +2 Done
- Garvin Hicking +2
- Simon Schaufelberger +1
-
Verified V +2 Done
- Garvin Hicking +2
- Simon Schaufelberger +1
- core-ci +1 CI
Issues 1
Files 11
- Build/Sources/TypeScript/backend/image-manipulation.ts+80 −0
- typo3/sysext/backend/Classes/Form/Element/ImageManipulationElement.php3+32 −0
- typo3/sysext/backend/Resources/Private/Templates/Form/ImageManipulationElement.fluid.html+1 −0
- typo3/sysext/backend/Resources/Private/Templates/Form/ImageManipulationWizard.fluid.html3+11 −0
- typo3/sysext/backend/Resources/Public/JavaScript/image-manipulation.js+1 −1
- typo3/sysext/backend/Tests/Unit/Form/Element/ImageManipulationElementTest.php2new+318 −0
- typo3/sysext/core/Classes/Imaging/ImageManipulation/CropVariant.php+18 −2
- typo3/sysext/core/Documentation/Changelog/14.2/Feature-105742-SynchronizedManipulationOfAllCropVariants.rstnew+90 −0
- typo3/sysext/core/Resources/Private/Language/locallang_wizards.xlf2+3 −0
- typo3/sysext/core/Tests/Unit/Imaging/ImageManipulation/CropVariantTest.php+1 −0
- typo3/sysext/styleguide/Configuration/TCA/tx_styleguide_elements_imagemanipulation.php+77 −1
Review log 5673
Show 3648 earlier messages
-
Christian Welzel uploaded patch set 1 12/03/24, 11:00
-
core-ci voted on patch set 1 V +1 12/03/24, 11:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70518
-
Garvin Hicking commented on patch set 1 12/03/24, 19:54
Hey, thanks for sharing. I think this is a nifty idea. However, maybe in reality often cropvariants might not sync up and then the button would vanish. So if I for example have 5 cutouts for 4/3 but one for 16/9 I would not be able to match 5 cutouts then due to the stray other format. If we could find a GUI to apply crops to a selection of other compatible variants (checkboxes? multiselects?) that would make it much more flexible. Or maybe having a "serialize this crop" button, and this is put in localStorage, and can be applied even to other images on other elements that are not open yet (maybe even multiple storages!). Once this is "buffered", a button like "apply serialized crop here" would appear. I know this would be far more complex, but maybe be more useful in the long run - what do you think? -
Christian Welzel commented on patch set 1 12/11/24, 17:58
Reply
Yes, i know that the filtering is very strict, but the problem is, that i know nothing for sure about the configuration. Aspects ratios (AR) can be named and defined independently for each crop variant. You can define an AR "xxx" differently in every CV, and you can give the same AR different names in every CV. So, if the user clicks the button "xxx", what should i use in the other CV? The AR with the same name or the AR with the same definition? And there is the case, where the AR doesn't even exist... I want to avoid a more complex GUI. If the editor has to select several buttons before being able to use the sync, it would be no timesaver anymore. And i think disabling the sync in more complex cases is valid. If the developer decided to make different ARs per CV, then there is a reason for this and syncing is most propably not wanted/useful. But i see your point. I extend the CV for tx_news records with an "preview"-CV and then cannot sync the other 6 CVs. Thats annoying. I think, i have to add some way to exclude certain CVs from syncing. But i see the task of defining these exclusions on developer side, not editor side. The Save-Button idea is great, but i see this as step 2 after integration of this patch. -
Garvin Hicking commented on patch set 1 12/11/24, 18:46
Reply
Thanks for getting back. I think it's worth trying to find a way that makes your idea of more efficient synchronizing of thunbnails more versatile and cover more scenarios. Since ARs all resolve to a float number maybe that can be used to identify the matching rations? But I admit not having dived to deep into this. And I agree, editors should be able to decide how to sync crops. Looking forward to your ideas :-) -
Christian Welzel uploaded patch set 2
V +102/28/25, 12:46 -
core-ci voted on patch set 2 V -1 02/28/25, 12:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74896
-
Christian Welzel commented on patch set 2 02/28/25, 13:00
Reply
I added a new configuration option for crop variants that is called "excludeFromSync". A developer can now decide to not allow synchronisation for a specific crop variant. This way synchronized cropping can be allowed (because the configurations are the same) but a special crop variant (eg for a listview) will not disable it anymore. This solution matches my use cases and is not too complicated for the editor. Trying to match AR by its values is not, what i think is a good solution, because it would match ARs by different names and meanings. It could match an AR "listview" (1/3) in CV 1 with an AR "photo" (1/3) in CV 2, which is not, what i want. -
Christian Welzel uploaded patch set 3
V -102/28/25, 13:10 -
core-ci voted on patch set 3 V -1 02/28/25, 13:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74897
-
Christian Welzel uploaded patch set 4
V -102/28/25, 13:21 -
core-ci voted on patch set 4 V -1 02/28/25, 13:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74898
-
Christian Welzel uploaded patch set 5
V -103/03/25, 10:51 -
core-ci voted on patch set 5 V +1 03/03/25, 10:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75003
-
Benni Mack marked it work in progress 03/21/25, 15:00
-
Christian Welzel uploaded patch set 6
V +105/09/25, 12:48 -
core-ci voted on patch set 6 V -1 05/09/25, 12:54 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78730
-
Christian Welzel commented on patch set 6 05/09/25, 12:55
This change is ready for review.Reply
I pushed new new patch set, this time without the patch to the javascript file, as it is build from typescript. -
Garvin Hicking commented on patch set 6 05/09/25, 16:29
Reply
hey thanks a lot - wasn't able to look into it yet, but will do next week. If you change the .ts files you always also need to commit the .js dile alongside it (and vice versa). -
Christian Welzel uploaded patch set 7
V -105/12/25, 13:33 -
Andreas Kienast commented on patch set 7 05/12/25, 13:36
Thank you very much for your patch. Please mind these two details here: * Features are usually not backported to LTS branches, therefore we include this patch in v13.4 * Features require some sort of documentation in form of a rst document. You may use https://forger.typo3.com/utilities/rst to generate one. -
core-ci voted on patch set 7 V +1 05/12/25, 13:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78802
-
Garvin Hicking commented on patch set 7 06/05/25, 12:53
Could you maybe provide a EXT:styleguide example alongside the patch where you setup a TCA element (in the "imagemanipulation" element) do showcase where this feature can be operated in? That would be great for easy reviewing! :)ImageManipulationElement.php:318Maybe we could have a unit test for this method to verify it working (also when getting refactored), and maybe use code a bit more telling what's going on, something like (untested): ``` function cropVariantsAreEqual(array $cropVariants): bool { $validVariants = array_filter( $cropVariants, static fn($variant) => !($variant['excludeFromSync'] ?? false) ); if (count($validVariants) <= 1) { return true; } $processedVariants = array_map(static function ($variant) { unset($variant['title']); return ArrayUtility::flatten($variant); }, $validVariants); $first = array_shift($processedVariants); return array_reduce( $processedVariants, static function ($allEqualSoFar, $currentVariant) use ($first) { return $allEqualSoFar && ($currentVariant === $first); }, true ); } ```ImageManipulationWizard.html:16We would need to use a f:translate localisation key for this here -
Christian Welzel uploaded patch set 8
V +108/14/25, 11:45 -
Christian Welzel commented on patch set 8 08/14/25, 11:50
Reply
DoneReply
DoneI hopefully resolved all mentioned issues now.ImageManipulationElement.php:318ReplyDoneImageManipulationWizard.html:16ReplyDone -
core-ci voted on patch set 8 V -1 08/14/25, 11:53 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83386
-
Christian Welzel uploaded patch set 9
V -108/14/25, 12:00 -
core-ci voted on patch set 9 V +1 08/14/25, 12:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83387
-
Garvin Hicking commented on patch set 9 08/14/25, 12:39
Nice! I'm on vacation right now but will try to look into it end of next week. Thanks for picking it up! -
Garvin Hicking uploaded patch set 10
V +109/02/25, 16:09Adjust whitespace and RST -
Garvin Hicking commented on patch set 10 CR +1 V +1 09/02/25, 16:14
First week after vacation and I finally got to it! This works pretty well for me. The code looks good to me, but I'd like some votes from the JavaScript-versed core members, too. The checkbox in the GUI looks a bit "lost", but I also have no better idea where/how to place it.ImageManipulationElement.php:329I thought we might have something more "lightweight" to check arrays being identical, but maybe I'm confusing this with PHPUnit array assertions. I think it's fair to do it like this, but if anyone knows an easier alternative, please share. -
core-ci voted on patch set 10 V +1 09/02/25, 16:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84263
-
Benni Mack commented on patch set 10 09/02/25, 16:34
locallang_wizards.xlf:184Sync = Synchronize? -
Garvin Hicking commented on patch set 11
CR +1V +109/02/25, 16:40Published edit on patch set 10. -
Garvin Hicking commented on patch set 11 CR +1 V +1 09/02/25, 16:40
locallang_wizards.xlf:184ReplyDone -
core-ci voted on patch set 11 V +1 09/02/25, 16:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84268
-
Simon Schaufelberger uploaded patch set 12
CR +1V +109/10/25, 10:37 -
Garvin Hicking voted on patch set 12 CR +1 V +1 09/10/25, 10:42
-
core-ci voted on patch set 12 V +1 09/10/25, 10:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84771
-
Simon Schaufelberger commented on patch set 12 09/10/25, 11:41
If the sync is available, I would expect the default to be enabled and the checkbox to be checked as I would assume the default usecase is to sync them and you only want to have different croppings in rare situations. Other than that, I'm happy. -
Garvin Hicking commented on patch set 12 09/10/25, 12:43
Reply
Hm, good question. I'm undecided on this, I can see this also being confusing if enabled by default due to prior usage in these cases. But maybe we would need a config option/flag to set the default for this? @gawain@camlann.de what do you think? -
Simon Schaufelberger commented on patch set 12 09/10/25, 13:04
Reply
Would it make sense to also persist if the images are synced or not? Then the checkbox can depend on that value. -
Garvin Hicking commented on patch set 12 09/10/25, 13:23
Reply
That's also a bit subjective I guess. I would opt against that because I'd say entering the cropping tool and making changes would be a "new choice" every time. But I'd be happy to iterate on that and try to first decide if we can do it like proposed (I would say so, which is why I voted on the current variant already) -
Christian Welzel commented on patch set 12 09/10/25, 14:33
Reply
I think, this option should not be enabled by default. At least in my usecases its not the default to edit all crop variants the same, its always for special occations (e.g. portrait pictures in a team page). I would hate to disable the feature in all images, that do not use it. So it should be an distinct decision of the editor to enable it. And yes, every call to the wizard should be a decision on its own. And this feature was meant to ease the working life of an editor, not to make it more complicated :-) -
Simon Schaufelberger commented on patch set 12 09/10/25, 14:41
Reply
My idea was that once i synced the pictures and want to adjust the cropping another time, i again have to click that checkbox and that feels kind of annoying to me. So i would only save the state of the checkbox for this single image, not as a general setting. In my opinion, this would slightly improve UX. -
Simon Schaufelberger commented on patch set 12 09/10/25, 14:43
Reply
I guess often it works like this: Crop, save, close. Show preview of the page. Does it look good?` No? Open cropping tool again, check that sync box and do adjustments. -
Christian Welzel commented on patch set 12 09/10/25, 15:01
Reply
I see your point. I think, saving the state of the box into the backend user session would be helpful for such usecases. Not sure, if that state should be saved globally or per image. -
Simon Schaufelberger commented on patch set 12 09/10/25, 15:24
Reply
Well, how is the currect selection of which aspect ratio is used saved? Wouldn't it make sense to add it there as additional field?
-
Garvin Hicking commented on patch set 12 09/10/25, 16:10
Reply
Storing it in the BE user session could swamp the session storage because you need one flag for each image you edit then. This might becone unpredictable/understandable. I would like to focus this in getting the feature itself in. Persisting (or not) could be done in a followup? Else we'll discuss this forever. ;) So my main issue to address is: Is that checkbox at a acceptable place and can the functionality itself be beneficial? (I'd say "yes") -
Christian Welzel commented on patch set 12 09/11/25, 09:39
Reply
The save format of the aspect ratios is not changed with this patch. And i think, this is absolute overkill. The status of this button can be saved by using the SessionStorage wrapper, which saves the values to the session storage of the browser. I dont think, that will overload the storage, as it gets cleared on browser exit but it will provide some convenience for Simons usecase. But i also think, its all about personal preferences. The patch should be integrated and then the user feedback should be evaluated before overcomplicating the whole little feature. -
Simon Schaufelberger commented on patch set 12 09/24/25, 14:01
Reply
I did some research how persisting the checkbox value could work. First of all, everything you see is persisted as json string in the crop field of the sys_file_reference table. That means we can't send other values with it as the checkbox is not part of the crop settings for each aspect ratio. That means the only possibility would be to create another hidden field but I'm not sure how to accomplish this with the way how the form engine works as we would suddenly send 2 values instead of one. The alternative would be to create a new TCA field for it but then you have 2 independent form engine fields which also sucks. So far I don't have any brilliant idea how to persist the value in the sys_file_reference table -
Christian Welzel uploaded patch set 13
CR +1V +111/26/25, 14:21 -
Christian Welzel commented on patch set 13 11/26/25, 14:26
I pushed a new version, rebased on 14.0.0. I changed the appearance of the button, the button text and added saving of the button state for an image to the browser session storge. -
Christian Welzel commented on patch set 13 11/26/25, 14:28
Reply
Not sure, what changes i did override from your patchsets, i'm very unfamiliar with this gerrit stuff. -
core-ci voted on patch set 13 V +1 11/26/25, 14:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91030
-
Simon Schaufelberger commented on patch set 13 CR -1 11/26/25, 14:46
ImageManipulationElementTest.php:30please fix the settings in your IDE, this is not the codestyle that we want in the core. -
Christian Welzel uploaded patch set 14
CR -1V +111/27/25, 13:06 -
Christian Welzel commented on patch set 14 11/27/25, 13:07
I imported patchset 12, reapplied my changes from 13. -
core-ci voted on patch set 14 V +1 11/27/25, 13:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91099
-
Simon Schaufelberger uploaded patch set 15
V +112/01/25, 17:22 -
Simon Schaufelberger commented on patch set 15 12/01/25, 17:22
ImageManipulationElementTest.php:30ReplyDone -
core-ci voted on patch set 15 V +1 12/01/25, 17:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91377
-
Simon Schaufelberger uploaded patch set 16
V +101/22/26, 22:22 -
core-ci voted on patch set 16 V +1 01/22/26, 22:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94106
-
Garvin Hicking commented on patch set 17
V +102/13/26, 20:34Published edit on patch set 16. -
Garvin Hicking commented on patch set 17 02/13/26, 20:34
Reply
I would like to not let this feature hang on the "persistence" part. Let's make it unpersisted for now.ImageManipulationWizard.fluid.html:16```suggestion <span><f:translate domain="core.wizards" key="imwizard.sync-crop-variants"/></span> ``` -
Garvin Hicking voted on patch set 17 CR +1 V +1 02/13/26, 20:34
-
core-ci voted on patch set 17 V +1 02/13/26, 20:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95843
-
Simon Schaufelberger voted on patch set 17 CR +1 V +1 02/13/26, 20:53
-
Simon Schaufelberger commented on patch set 17 02/13/26, 20:55
ImageManipulationWizard.fluid.html:16Replywhy is this resolved already? -
Simon Schaufelberger commented on patch set 17 02/13/26, 20:55
ImageManipulationWizard.fluid.html:16Replyok, old changeset... -
Garvin Hicking voted on patch set 17 CR +2 V +2 02/16/26, 10:13
-
Garvin Hicking merged patch set 18 02/16/26, 10:13