Bug #103047
closedCrop-Variants with dot in variant-name are not being saved
100%
Description
I've recently defined some new crop-variants for a project with custom aspect-ratios like 1:1.4 (775/545),
which looks in TCA-Code for a specific image-relation like this:
'tx_ifmainmetallce_image' => [
'config' => [
'overrideChildTca' => [
'columns' => [
'crop' => [
'config' => [
'cropVariants' => [
'default' => [
'disabled' => true,
],
'teaser-2023' => [
'title' => 'Teaser 2023',
'allowedAspectRatios' => [
'1:1' => [
'title' => '1:1 [545x545]',
'value' => 1
],
'1:1.4' => [
'title' => '1:1.4 [775x545]',
'value' => 775/545
],
],
],
],
],
]
],
],
],
],
While testing the 1:1.4 crop-variant seems to work at first glance (frontend crop-ui) works! But when saving it's lost falling back to the first one (default entry). After I changed the key from '1:1.4' to '1:1,4' it worked.
For some reason a dot in they array identifier-key seems to break the functionality. I think this either should be fixed to make it work more intuitive or if there is any good reason for the dot (".") having a special meaning, both should be documented in crop-variants documenation. I didn't notice any kind of hint on this.
Updated by Gabriel Kaufmann / Typoworx NewMedia 10 months ago
Sorry for the ugly code-block. Is there any reason using the "C" (Code-block) feature doesn't format spacing well or at least apply some kind of auto-formattings?
Updated by Lukas Maxheim 10 months ago ยท Edited
Gabriel Kaufmann / Typoworx NewMedia wrote in #note-1:
Sorry for the ugly code-block. Is there any reason using the "C" (Code-block) feature doesn't format spacing well or at least apply some kind of auto-formattings?
You can use the "Highlighted code" function in combination with the PHP option to format your snippet in this case.
Kind regards
Lukas
Updated by Gabriel Kaufmann / Typoworx NewMedia 10 months ago
Lukas Maxheim wrote in #note-2:
You can use the "Highlighted code" function in combination with the PHP option to format your snippet in this case.
Thanks will try to keep that in mind. Sadly I'm not able to edit my past text to fix it here.
Updated by Gerrit Code Review 5 months ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84604
Updated by Gerrit Code Review 5 months ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84604
Updated by Gerrit Code Review 5 months ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84604
Updated by Gerrit Code Review 5 months ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84604
Updated by Gerrit Code Review 5 months ago
Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84604
Updated by Gerrit Code Review 5 months ago
Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84604
Updated by Georg Ringer 5 months ago
- Status changed from Under Review to New
wrong issue number in gerrit used, resting status to new
Updated by Gerrit Code Review 5 months ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84718
Updated by Garvin Hicking 5 months ago
- Category changed from Backend API to Image Cropping
Indeed this is a "hack" in the old code that needed to reference aspect ratio key names in Fluid notation, where a "." is breaking. This was addressed in #80214 in the past.
My patch addresses the problem by "fixing" the dot in two places so that it can correctly be referenced.
IMO this is an ugly workaround that needs to go away, but since people out there may utilize such crop aspect ratios (they are persisted to the database), properly fixing them and allowing "." character for real would break matching the aspect ratios to existing data. So we can only do that in v14 I believe, as a breaking change.
But meanwhile this patch could help solve the bug for you.
Updated by Garvin Hicking 5 months ago
- Related to Bug #80214: ImageManipulation: Example for dynamic variable name parts breaks BE added
Updated by Gerrit Code Review 5 months ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84718
Updated by Gerrit Code Review 5 months ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84718
Updated by Gerrit Code Review 5 months ago
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84852
Updated by Garvin Hicking 5 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 0f48be2af04b13944f16a80013cf87e22fd0272b.