Review main Merged

83299[TASK] Avoid duplicate image crop (crop-crop-scale to crop-scale)

Benjamin Franzke CR +2 V +2 Hard +375 −407 updated 03/11/24, 15:55

Commit message

Image cropping has been performed in two steps in
case a cropArea (e.g. be the editor) and a crop
scale modifier (e.g. "400c" set be the integrator) was combined.

These two similar values are now normalized into one
cropArea, which simplifies image processing by requiring
one crop+scale step instead of one pre-crop plus a second
crop-scale step.

Note that some tests had to be adapted either because of
rounding fixes (we now use round() instead of cast-floor or
ceils) and some previous unexpected results (flagged with "why!?")
do now produce expected and logical results. (minWidth caused
distortion instead of aspect-ratio-preserving scaling)

There is one additional behavior adaption: masked sizes (e.g. "400m")
no longer upscale images that are smaller. That means masked sizes
effectively behaves as `maxWidth` always did. A new testcase is added
for this case.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Garvin Hicking +1
    • Oliver Hader +1
  • Verified V +2 Done
    • Benni Mack +2
    • Garvin Hicking +1
    • Oliver Hader +1
    • core-ci +1 CI

Issues 2

Files 10

Review log 2944

Show 1019 earlier messages
  1. Benjamin Franzke uploaded patch set 1 03/07/24, 09:19

  2. core-ci voted on patch set 1 V -1 03/07/24, 09:26 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54122

  3. Benjamin Franzke uploaded patch set 2 V -1 03/07/24, 10:38

  4. core-ci voted on patch set 2 V -1 03/07/24, 10:44 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54128

  5. Benjamin Franzke uploaded patch set 3 V -1 03/07/24, 11:04

  6. core-ci voted on patch set 3 V -1 03/07/24, 11:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54130

  7. Benjamin Franzke uploaded patch set 4 V -1 03/07/24, 21:00

  8. core-ci voted on patch set 4 V -1 03/07/24, 21:05 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54192

  9. Benjamin Franzke uploaded patch set 5 V -1 03/07/24, 21:59

  10. core-ci voted on patch set 5 V -1 03/07/24, 22:05 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54198

  11. Benjamin Franzke uploaded patch set 6 V -1 03/07/24, 22:17

  12. core-ci voted on patch set 6 V +1 03/07/24, 22:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54199

  13. Benjamin Franzke uploaded patch set 7 V +1 03/07/24, 22:29

  14. core-ci voted on patch set 7 V -1 03/07/24, 22:36 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54200

  15. Benjamin Franzke uploaded patch set 8 V -1 03/07/24, 22:39

  16. core-ci voted on patch set 8 V +1 03/07/24, 22:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54201

  17. Benjamin Franzke uploaded patch set 9 V +1 03/08/24, 09:05

  18. core-ci voted on patch set 9 V +1 03/08/24, 09:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54212

  19. Benjamin Franzke uploaded patch set 10 V +1 03/08/24, 18:17

  1. core-ci voted on patch set 10 V +1 03/08/24, 18:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54296

  2. Benjamin Franzke uploaded patch set 11 V +1 03/08/24, 18:55

  3. core-ci voted on patch set 11 V +1 03/08/24, 19:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54303

  4. Benni Mack commented on patch set 11 03/08/24, 19:24

    GraphicalFunctions.php:464

    we can remove this method now
  5. Benjamin Franzke uploaded patch set 12 V +1 03/08/24, 19:30

  6. Benjamin Franzke commented on patch set 12 03/08/24, 19:30

    GraphicalFunctions.php:464 Reply

    Done
  7. core-ci voted on patch set 12 V +1 03/08/24, 19:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54306

  8. Benjamin Franzke rebased onto patch set 13 V +1 03/08/24, 21:06

  9. core-ci voted on patch set 13 V +1 03/08/24, 21:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54309

  10. Benni Mack commented on patch set 13 03/08/24, 21:52

    ImageDimension.php:91

    so good to get rid of this code!

    ImageProcessingInstructions.php:144

    should always throw an exception, I think this is OK.

    ImageProcessingInstructions.php:169

    we can move the (int)casting now to line 160, I guess.

    ImageProcessingInstructions.php:211

    better exception handling (I think we need a custom / new exception here)
  11. Benjamin Franzke uploaded patch set 14 V +1 03/11/24, 07:17

  12. Benjamin Franzke commented on patch set 14 03/11/24, 07:17

    ImageDimension.php:91 Reply

    Acknowledged

    ImageProcessingInstructions.php:144 Reply

    Done

    ImageProcessingInstructions.php:169 Reply

    No, because `$cropOffsetHorizontal = (int)substr((string)strstr((string)$width, 'c'), 1);` still needs the string value to be able to chop of the `'c'` suffix.

    ImageProcessingInstructions.php:211 Reply

    ack, totally forgot about that one. I think this case would actually be a bug in our code and therefore marked it as `LogicException`.
  13. core-ci voted on patch set 14 V +1 03/11/24, 07:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54347

  14. Benni Mack voted on patch set 14 CR +1 V +1 03/11/24, 07:43

  15. Andreas Kienast voted on patch set 14 CR +1 03/11/24, 08:19

  16. Oliver Hader commented on patch set 14 CR -1 03/11/24, 08:51

    Will test this soon...
  17. Garvin Hicking commented on patch set 14 CR +1 V +1 03/11/24, 09:15

    Huge rework, I probably can't grasp all of it, but the tests I performed with various assets and crops all worked. Tests feel confident too. :D Thanks to all involved for putting so much work effort into this, much appreciated!
  18. Oliver Hader uploaded patch set 15 CR +1 V +1 03/11/24, 15:04

  19. Oliver Hader commented on patch set 15 CR +1 V +1 03/11/24, 15:07

    Upscaling is different, but looks visually correct now. I've extracted test some test changes to https://review.typo3.org/c/Packages/TYPO3.CMS/+/83405 to reflect the `inline max` changes...
  20. core-ci voted on patch set 15 V +1 03/11/24, 15:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54370

  21. Benni Mack voted on patch set 15 CR +1 V +1 03/11/24, 15:20

  22. Garvin Hicking voted on patch set 15 CR +1 V +1 03/11/24, 15:52

  23. Benni Mack commented on patch set 15 CR +2 V +2 03/11/24, 15:53

    Reply

    Done
  24. Benni Mack merged patch set 16 03/11/24, 15:53

  25. Benjamin Franzke commented on patch set 15 CR +2 V +2 03/11/24, 15:55

    Reply

    Thanks for the adaptions.