Project

General

Profile

Actions

Bug #101520

closed

Crop variant editor doesn't remember certain crop area positions

Added by Robert Kärner 10 months ago. Updated about 1 month ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
Image Cropping
Target version:
-
Start date:
2023-08-01
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Short Description:
The image cropping editor in the backend has problems remembering the crop area of an image under certain circumstances.
This happens when a aspect ratio setting is active and the crop area touches both the left and the right border of the actual image.

Steps to reproduce:
  • Setup and install a fresh version of TYPO3 v12 or v11. I haven't tested v10 or lower, so the issue might happen there as well.
  • Add this additional TCA override configuration:
    $GLOBALS['TCA']['pages']['columns']['media']['config']['overrideChildTca']['columns']['crop']['config'] = [
        'cropVariants' => [
            'desktop' => [
                'title' => 'Desktop',
                'allowedAspectRatios' => [
                    '16:5' => [
                        'title' => '16:5',
                        'value' => 16 / 5
                    ]
                ]
            ],
            'mobile' => [
                'title' => 'Mobile',
                'allowedAspectRatios' => [
                    '11:5' => [
                        'title' => '11:5',
                        'value' => 11 / 5
                    ]
                ],
                'selectedRatio' => '11:5'
            ]
        ]
    ];
    
  • Upload any image you like to the installation. You can use the provided example image of a railroad attached to this issue. This image is public domain and free of copyright restrictions (http://www.publicdomainfiles.com/show_file.php?id=13940998218719)
  • Create a new empty page in the backend page tree.
  • Add the image to the page resources (Resources > Media > Create new relation)
  • Save the page record (optional)
  • Open the image manipulation editor
  • Create or move the crop area so that it touches the left, the bottom and the right border of the actual image:
  • Click Accept
  • Save the page record (optional)
  • The IRRE shows the correctly cropped part of the image as a thumbnail (and it would work perfectly fine in frontend as well)
  • Open the image manipulation editor again
  • Expectation: The editor shows the correct position of the cropped area, but instead it is somewhere in the center:
  • Move the cropped area to the bottom again
  • This time, don't click Accept, but switch to the Mobile crop variant and then back to Desktop
  • The cropped area has moved again. However, the orange rectangle on the thumbnail top right still shows the old bottom position:
  • Again, switch to the Mobile crop variant and then back to Desktop
  • Now the thumbnail has finally updated:
  • Try again with a) the cropped area sitting at the top (touching left, top and right), b) somewhere else in the middle (only touching left and right). The same bug will occur.
  • Now try again with the cropped area only touching the left, only the right or no borders at all. Now the bug won't appear and everything works as expected.

Files

the-railroad-goes-into-the-distance.jpg (698 KB) the-railroad-goes-into-the-distance.jpg Robert Kärner, 2023-08-01 10:39
crop_01.png (1.32 MB) crop_01.png Robert Kärner, 2023-08-01 10:56
crop_02.png (1.17 MB) crop_02.png Robert Kärner, 2023-08-01 11:00
crop_03.png (1.17 MB) crop_03.png Robert Kärner, 2023-08-01 11:02
crop_04.png (1.17 MB) crop_04.png Robert Kärner, 2023-08-01 11:02
Actions

Also available in: Atom PDF