Created on 30 September 2024, 7 months ago

Here are some suggestions

  1. We remove exif_orientation_file_presave() and instead always add an upload validator. This simplifies the code and solves the "too late" problems. Hence we remove _exif_orientation_rotate() and the code can be directly in the FileImageExifOrientationConstraintValidator.
  2. We could copy 4 files from image_effects to give the auto_orient and mirror operations. This significantly simplifies the validation code, removes the (now incorrect) orientation from the EXIF and it can handle flipped images. However what would happen if both modules are installed? Can we make ours lower priority? Maybe we pick different operation names??
🌱 Plan
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom adamps

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @adamps
  • πŸ‡¬πŸ‡§United Kingdom adamps
  • Merge request !13Overall combined fix β†’ (Open) created by adamps
  • πŸ‡¬πŸ‡§United Kingdom adamps
  • Pipeline finished with Success
    7 months ago
    Total: 153s
    #298214
  • Pipeline finished with Success
    7 months ago
    Total: 153s
    #298215
  • Pipeline finished with Success
    7 months ago
    Total: 184s
    #298700
  • Status changed to Needs review 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States msielski

    Found this issue via issue #3401578. I'm not able to use the solution here because of the change from using hook_file_presave to only using a form alter. In my use case, images are created via another module (media_acquiadam, but I imagine any situation where images come in via an API would be affected), so the form alter approach gets skipped while the the hook_file_presave approach would work.

  • πŸ‡·πŸ‡΄Romania alex.stanciu

    Here's a patch for this MR which adds support for the imagick toolkit, if you find it useful.

  • πŸ‡¬πŸ‡§United Kingdom adamps

    @msielski Yes you are right, good point.

    @staalex Thanks

  • Status changed to Needs work 14 days ago
  • First commit to issue fork.
  • Pipeline finished with Success
    14 days ago
    Total: 264s
    #471529
  • πŸ‡ΊπŸ‡ΈUnited States greenskin

    Made a merge request into the 3477919-overall-combined-fix branch that adds the `hook_file_presave()` hook back in (applies orientation changes in cases where the upload validation isn't applicable), and fixes an issue where the orientation value doesn't get removed for orientations other than 5, 6, 7, and 8.
    See 3477919-overall_combined_fix-tweaks

  • First commit to issue fork.
  • πŸ‡«πŸ‡·France tostinni

    @greenskin, adding back the exif_orientation_file_presave() fixed a bug that we had where the exif rotation wasn't working when adding an image through the media library, so I'm adding this in the main MR.

    For the other part regarding fixing "the orientation value doesn't get removed for orientations" can you describe how to test it ?
    I haven't added it for the moment, and if it's needed then we should also patch the GD part in src/Plugin/ImageToolkit/Operation/gd/AutoOrient.php

    @adamps I imagine this part should be written as annotations ?

    #[ImageToolkitOperation(
      id: 'exif_orientation_gd_auto_orient',
      toolkit: 'gd',
      operation: 'auto_orient',
      label: new TranslatableMarkup('Auto orient image'),
      description: new TranslatableMarkup('Automatically adjusts the orientation of an image.'),
    )]
  • Pipeline finished with Success
    about 2 hours ago
    #482186
Production build 0.71.5 2024