The selected image handling toolkit 'imagemagick' can not process operation 'rotate'.

Created on 16 July 2024, 5 months ago

Problem/Motivation

The module attempts to call ImageInterface::rotate() but imagemagick toolkit does not support the 'rotate' operation
https://git.drupalcode.org/project/exif_orientation/-/blob/8.x-1.4/exif_...

which results in a watchdog error:
The selected image handling toolkit 'imagemagick' can not process operation 'rotate'.

Steps to reproduce

  • Install the module
  • Select 'ImageMagick' toolkit on /admin/config/media/image-toolkit
  • Try to upload an image with non empty exif:Orientation

Proposed resolution

For ImageMagick use the 'rotate_ie' operation provided by https://www.drupal.org/project/image_effects

🐛 Bug report
Status

Active

Version

1.4

Component

Code

Created by

🇨🇦Canada klimp Montréal, QC

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

Merge Requests

Comments & Activities

  • Issue created by @klimp
  • 🇨🇦Canada klimp Montréal, QC
  • Status changed to Needs review 5 months ago
  • 🇨🇦Canada klimp Montréal, QC
  • Merge request !11Resolve #3461811 "Imagemagick rotate" → (Open) created by klimp
  • Pipeline finished with Failed
    5 months ago
    Total: 191s
    #225865
  • 🇨🇦Canada klimp Montréal, QC
  • 🇨🇦Canada klimp Montréal, QC

    Because the issue fork includes composer.json please don't use a patch. Otherwise it won't pull dependencies.

    Use the fork repo instead:

            {
                "type": "composer",
                "url": "https://packages.drupal.org/8",
                "exclude": [
                    "drupal/exif_orientation"
                ]
            },
    
            {
                "type": "git",
                "url": "https://git.drupalcode.org/issue/exif_orientation-3461811.git"
            }
    

    Then call
    composer require drupal/exif_orientation:dev-3461811-imagemagick-rotate

  • 🇨🇦Canada klimp Montréal, QC
  • Status changed to Needs work 3 months ago
  • 🇬🇧United Kingdom adamps

    If we require image_effects this is a big change for this module. It causes problems for sites upgrading who won't have the dependency installed. Also it pulls in another module file_mdm, and it adds a lot of extra settings for image effects. Perhaps not everyone wants this, especially those using gd. Currently this module is very small and simple which is attractive.

    On the other hand, if we do have image_effects, then we should use the auto_rotate command as described in 🐛 The module doesn't work with Imagick toolkit Active . This simplifies the code, removes the (now incorrect) orientation from the EXIF and it can handle flipped images.

    I can see some options:

    1. We could copy 4 files from image_effects to give the auto_orient and mirror operations. However what would happen if both modules are installed? Can we make ours lower priority? Maybe we pick a different name?
    2. We could instead write code that uses image_effects if it is found. However if the module is missing it's OK so long as the toolkit isn't imagemagick.
  • 🇬🇧United Kingdom adamps

    I now have a patch that hopefully fixes this issue and several others in 🌱 Overall status Active . Please help to test and review.

Production build 0.71.5 2024