Review main Merged

75422[BUGFIX] Make sure social media images gets processed if needed

Kevin Appelt CR +2 V +2 Hard +266 −28 updated 08/22/22, 18:01

Commit message

The check if the image has to be processed has been moved to
dedicated methods to enhance readability and testability

The condition still checks if the image is wider than the defined
maximum width. The check if the entire image is used should now be
easier to understand. No offset and 100% of the width and height
of the image correspond to the full image and negated in its entirety.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Sascha Egerer +1
    • Oliver Hader +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Sascha Egerer +1
    • Oliver Hader +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 5366

Show 3441 earlier messages
  1. Kevin Appelt uploaded patch set 1 08/12/22, 08:03

  2. core-ci voted on patch set 1 V +1 08/12/22, 08:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30064

  3. Chris Müller commented on patch set 1 CR -1 08/12/22, 08:22

    The "Releases:" line is missing.
  4. Oliver Klee commented on patch set 1 08/12/22, 08:23

    MetaTagGenerator.php:171

    Please add native type declarations for the parameters.
  5. Kevin Appelt uploaded patch set 2 08/12/22, 08:28

  6. Kevin Appelt commented on patch set 2 08/12/22, 08:28

    Reply

    Done

    MetaTagGenerator.php:171 Reply

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

  8. Benni Mack commented on patch set 2 08/12/22, 08:54

    Hey Kevin, since this is a regression, could you please explain a bit more in detail what was the problem and how it is solved (in Commit Message and maybe in the new class method)? Thx
  9. Sascha Egerer commented on patch set 2 CR -1 08/12/22, 09:02

    So what is the difference now to the previous behavior? Now we're back to process every image that does not has a cropping defined. So i do not see any benefit of the previous patch, or am i wrong?
  10. Oliver Klee commented on patch set 2 08/12/22, 09:30

    MetaTagGenerator.php:180

    Please also always use strict checks (===).
  11. Kevin Appelt uploaded patch set 3 08/16/22, 06:10

  12. Kevin Appelt commented on patch set 3 08/16/22, 06:16

    Reply

    Originally ALL images were processed. Even a perfect 1200x630 image (correct aspect ratio and not too wide) was processed. This is now no longer the case.

    Reply

    Done.

    MetaTagGenerator.php:180 Reply

    Strict checks seemed to be the problem in the beginning. I added strict checks now and it seems to work as intended. Please verify carefully!
  13. Kevin Appelt rebased onto patch set 4 08/16/22, 06:16

  14. Stefan Bürk commented on patch set 4 08/16/22, 08:00

    Cancelled Pipeline run for patchset 3
  15. core-ci voted on patch set 4 V -1 08/16/22, 08:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30184

  16. Kevin Appelt uploaded patch set 5 08/16/22, 08:25

  17. core-ci voted on patch set 5 V +1 08/16/22, 08:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30187

  18. Stefan Bürk updated the commit message in patch set 6 08/16/22, 08:33

  19. core-ci voted on patch set 6 V +1 08/16/22, 08:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30188

  20. Simon Schaufelberger commented on patch set 6 08/16/22, 10:50

    MetaTagGenerator.php:178

    should be removed if they don't add value
  21. Markus Klein commented on patch set 6 CR +1 08/16/22, 11:00

    MetaTagGenerator.php:178 Reply

    Disagree: If we provide a method description those params shall be present too. They are generated anyway by the IDE, usually. If we have a phpdoc that has nothing but params listing without any additional description, then this is unnecessary.
  22. Markus Klein commented on patch set 6 08/16/22, 11:01

    MetaTagGenerator.php:187

    what about height and maxHeight?
  23. Markus Klein voted on patch set 6 CR 0 08/16/22, 11:01

  24. Stefan Bürk commented on patch set 6 08/16/22, 11:04

    MetaTagGenerator.php:178 Reply

    Core rule is to remove these, expect a specific param/return type has a valuable explanation (and than all should be added/kept) (if all have native types instead). Having a method description without params/return type is thus okay.
  25. Kevin Appelt commented on patch set 6 08/16/22, 11:08

    MetaTagGenerator.php:178 Reply

    I would agree with Markus.

    MetaTagGenerator.php:187 Reply

    Firstly, there is no maximum defined height in the configuration, we would have to add this. However, the aspect ratio and the maximum width mathematically result in a maximum height. So if the image does not meet the second condition ("is whole image") the first condition with the width takes effect automatically, should the height be too large (greater than 800 px), because then the width is over 2000 px.
  26. Kevin Appelt commented on patch set 6 08/16/22, 11:10

    MetaTagGenerator.php:178 Reply

    Sorry, did not saw your comment Stefan. If this is the rule, I remove the params from the phpdoc.
  27. Kevin Appelt uploaded patch set 7 08/16/22, 11:16

  28. Kevin Appelt commented on patch set 7 08/16/22, 11:16

    MetaTagGenerator.php:178 Reply

    Done
  29. Stefan Bürk commented on patch set 7 08/16/22, 11:19

    MetaTagGenerator.php:178 Reply

    You pushed not using the last patchset. I edited the commit message, which is flattered again in gerrit (overriden).
  30. core-ci voted on patch set 7 V +1 08/16/22, 11:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30197

  31. Annett Jähnichen commented on patch set 7 V +1 08/16/22, 12:36

    Tested in main branch and version 11.5.14 with patch.
  32. Simon Schaufelberger updated the commit message in patch set 8 08/16/22, 13:28

  33. Simon Schaufelberger commented on patch set 8 08/16/22, 13:29

    restored the cleaned up commit message
  34. core-ci voted on patch set 8 V +1 08/16/22, 13:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30203

  35. Annett Jähnichen voted on patch set 8 V +1 08/16/22, 14:07

  36. Simon Schaufelberger voted on patch set 8 CR +1 08/16/22, 14:57

  37. Sascha Egerer commented on patch set 8 CR -1 08/17/22, 09:32

    MetaTagGenerator.php:187 Reply

    But the hight is not taken into account if no cropping is done. So an Image with 1000x99999 will still not be processed anymore.
  38. Oliver Hader commented on patch set 8 08/18/22, 14:23

    MetaTagGenerator.php:187 Reply

    From my point of view resizing shall be applied with the given aspect ratio in case an image dimension exceeds the given bounding box (which is 2000x1050 - height calculated by defined aspect ratio in configuration).
  39. Kevin Appelt commented on patch set 8 08/19/22, 15:07

    MetaTagGenerator.php:187 Reply

    The image would still be processed. Because the image does not correspond to the aspect ratio of 1200:630. This means that cropping takes effect (active selection is possible, but not necessary!). Due to the (image) width of 1000 pixels, the height is thus 525 pixels. It is therefore still not necessary to define a fixed maximum height, as this results mathematically.
  40. Oliver Hader uploaded patch set 9 08/22/22, 12:31

  41. Oliver Hader uploaded patch set 10 08/22/22, 12:37

  1. Oliver Hader commented on patch set 10 V +1 CR +1 08/22/22, 12:39

    Looks good to me. Additional tests assert the corresponding behavior and when files shall be processed. @SaschaEgerer: Could you please have a look? I'd like to release this soonish...
  2. core-ci voted on patch set 9 V -1 08/22/22, 12:41 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30346

  3. core-ci voted on patch set 10 V -1 08/22/22, 12:46 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30347

  4. Oliver Hader uploaded patch set 11 08/22/22, 12:59

  5. Oliver Hader commented on patch set 11 V +1 CR +1 08/22/22, 13:00

    Made PhpStan happy...
  6. core-ci voted on patch set 11 V +1 08/22/22, 13:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30350

  7. Simon Schaufelberger wrote 08/22/22, 13:11

    Removed reviewer Simon Schaufelberger.
  8. Sascha Egerer commented on patch set 11 V +1 CR +1 08/22/22, 13:42

    OK, i was not aware that the CropVariant is build up automatically with all this data so it can be used like that. Looks good now (as far as the file relation contains the correct crop information)!
  9. Oliver Hader commented on patch set 11 08/22/22, 13:48

    Reply

    Yes, I also did not know that... but with reproducing the behavior of `ImageManipulationElement` in a functional test, it can be reproduced. When data is provided to `DataHandler` directly (without invoking the view via `FormEngine`) the behavior is different - but that's the case already without these changes in ext:seo.
  10. Sascha Egerer commented on patch set 11 V 0 08/22/22, 13:49

    Ok.. I'll still break for file relations that have been created in older TYPO3 versions as those do not contain the "social" crop in the file relation. As far as i can see there have been no upgrade that ensures that these crop area is set for older databases. It was introduced in https://github.com/TYPO3/typo3/commit/e1ffbaab4fb1d3363869bc2fc7d492fa3528833c
  11. Oliver Hader commented on patch set 11 08/22/22, 13:52

    Reply

    That was introduced for TYPO3 v9.5.1...
  12. Oliver Hader uploaded patch set 12 08/22/22, 14:37

  13. Oliver Hader uploaded patch set 13 08/22/22, 14:41

  14. core-ci voted on patch set 13 V +1 08/22/22, 14:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30352

  15. Oliver Hader commented on patch set 13 08/22/22, 14:49

    MetaTagGenerator.php:187 Reply

    Done
  16. Sascha Egerer commented on patch set 13 08/22/22, 14:50

    MetaTagGeneratorTest.php:170

    Would be better readable if we do not negate but switch the arguments. But i think it would be even better if we do not do it as inline condition but put it around the code above so cropVariantCollection is never created if emptyCrop = true
  17. core-ci voted on patch set 12 V +1 08/22/22, 14:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30351

  18. Oliver Hader uploaded patch set 14 08/22/22, 14:54

  19. Oliver Hader commented on patch set 14 08/22/22, 14:55

    MetaTagGeneratorTest.php:170 Reply

    Done
  20. Sascha Egerer voted on patch set 14 V +1 CR +1 08/22/22, 15:00

  21. core-ci voted on patch set 14 V +1 08/22/22, 15:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30353

  22. Oliver Hader voted on patch set 14 V +1 CR +1 08/22/22, 15:20

  23. Benjamin Franzke commented on patch set 14 V +1 CR +1 08/22/22, 17:57

    Unresolved

    This sentence is quite hard (for me) to understand. I actually had to read the code to understand what the fix/bug/wrong-negation was. So I summarise it here for others: Cropping was applied only if the image was both, cropped in width and in height, cropping was not applied if only one, width or height dimension was cropped. Other than that the patch is CR+1 by me.
  24. Benjamin Franzke voted on patch set 14 V +2 CR +2 08/22/22, 18:01

  25. Benjamin Franzke merged patch set 15 08/22/22, 18:01