Review main Abandoned

67173[BUGFIX] Images are streched when crop area changes its aspect ratio

Thomas Maroschik CR 0 V 0 Easy +8 −0 updated 12/22/20, 05:39

Commit message

Change #91855 optimized the image processing. When the crop area changes
the images aspect ratio, the scaled dimensions are still calculated upon
the original image sizes instead of the size of the crop area. This leads
to streched images.

This fix adjusts the image info in the ->getImageScale method so, that
the resulting size is derived correctly again.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 1

Review log 1113

  1. Thomas Maroschik uploaded patch set 1 12/17/20, 09:49

  2. TYPO3com voted on patch set 1 V -1 12/17/20, 09:58 Completed build in 08m 09s on Thu, 17 Dec, 09:58 AM Test Summary: 4 of 32674 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8222

  3. Simon Gilli commented on patch set 1 12/17/20, 09:58

    We should also check if this resolves 93085 and 93086 too.
  4. Thomas Maroschik uploaded patch set 2 12/17/20, 10:16

  5. TYPO3com voted on patch set 2 V +1 12/17/20, 10:26 Completed build in 09m 35s on Thu, 17 Dec, 10:26 AM Test Summary: 32433 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8224

  6. Thomas Maroschik commented on patch set 2 12/17/20, 10:33

    Fun fact: ImageDimensions actually got the dimensions correct in the same way as this patch does. It relies internally upon \TYPO3\CMS\Core\Imaging\GraphicalFunctions::getImageScale, but applies the crop dimensions to image info by itself. Therefore the bug didn't show up in tests.
  7. Helmut Hummel commented on patch set 2 CR -1 12/17/20, 10:44

    I think this change is wrong. Can you provide an exact case to reproduce in the ticket? thanks.
  8. Thomas Maroschik commented on patch set 2 12/17/20, 11:29

    Reply Unresolved

    Of course. Take this image here http://toujou.de/fileadmin/toujou/demo/demo_01.jpg with dimensions 1920x1440. Then crop it in a content element to full width, but roughly 1084px height. After that, try to scale the image to maxW => 425 and maxH => 240. If my patch is applied, the width of the resulting image will be 425 pixels. If not it will be 320 and streched.
  9. Josef Glatz commented on patch set 2 V +1 12/17/20, 15:29

    The patch removes the problems I actually found in the BE and FE from the perspective of an editor/website-user: I tested following path: - Upgrade to 10.4.11 - Change a crop of one cropVariant of a custom pages column - save - after the formEngine reloads the page the cropped image is shown wrong - also the FE is not correct anymore - then I applied the patch from Tom - I cropped the image once more in the backend - voilà: after saving the cropped image looks correct in FE and BE
  10. Jörn Wagner commented on patch set 2 V +1 12/18/20, 12:10

    I can also confirm that this solves the recent problems introduced in 10.4.10 with regards to image cropping.
  11. Florian Langer commented on patch set 2 V +1 12/19/20, 17:07

    Unresolved

    I can also confirm, that this is solving the cropping issue.
  12. Markus Klein commented on patch set 2 V -1 CR -1 12/21/20, 18:53

    Please abandon this patch. The original change has been reverted. See https://forge.typo3.org/issues/93139
  13. Thomas Maroschik abandoned the change 12/22/20, 05:39

    The original change has been reverted. See https://forge.typo3.org/issues/93139