Project

General

Profile

Actions

Bug #103047

closed

Crop-Variants with dot in variant-name are not being saved

Added by Gabriel Kaufmann / Typoworx NewMedia 5 months ago. Updated 8 days ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Image Cropping
Target version:
-
Start date:
2024-02-05
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
backend, crop-variant
Complexity:
Is Regression:
Sprint Focus:

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.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #80214: ImageManipulation: Example for dynamic variable name parts breaks BEClosed2017-03-09

Actions
Actions #1

Updated by Gabriel Kaufmann / Typoworx NewMedia 5 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?

Actions #2

Updated by Lukas Maxheim 5 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

Actions #3

Updated by Gabriel Kaufmann / Typoworx NewMedia 5 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.

Actions #4

Updated by Gerrit Code Review about 1 month 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

Actions #5

Updated by Gerrit Code Review about 1 month 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

Actions #6

Updated by Gerrit Code Review about 1 month 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

Actions #7

Updated by Gerrit Code Review about 1 month 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

Actions #8

Updated by Gerrit Code Review about 1 month 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

Actions #9

Updated by Gerrit Code Review about 1 month 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

Actions #10

Updated by Georg Ringer about 1 month ago

  • Status changed from Under Review to New

wrong issue number in gerrit used, resting status to new

Actions #11

Updated by Garvin Hicking about 1 month ago

  • Description updated (diff)
Actions #12

Updated by Gerrit Code Review about 1 month 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

Actions #13

Updated by Garvin Hicking about 1 month 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.

Actions #14

Updated by Garvin Hicking about 1 month ago

  • Related to Bug #80214: ImageManipulation: Example for dynamic variable name parts breaks BE added
Actions #15

Updated by Gerrit Code Review 28 days 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

Actions #16

Updated by Gerrit Code Review 26 days 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

Actions #17

Updated by Gerrit Code Review 26 days 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

Actions #18

Updated by Garvin Hicking 26 days ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #19

Updated by Benni Mack 8 days ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF