Add support for ImageMagick Toolkit

Created on 2 August 2024, 5 months ago

Problem/Motivation

The module appears to only be compatible with GD2 Image Toolkit. If you are using another toolkit, such as ImageMagick, it throws an error when you try to create a new image style that uses this effect. (The error was something along the lines of:
Call to undefined method getResource on null in docroot/modules/contrib/imagemagick/src/Plugin/ImageToolkit/ImagemagickToolkit.php

Steps to reproduce

Install the ImageMagick toolkit module. https://www.drupal.org/project/imagemagick β†’
Enable the ImageMagick toolkit on /admin/config/media/image-toolkit.
Create a new Image Style that uses the Image Scale and Fill effect.
Try to save the style - an error will be thrown.

Proposed resolution

At a minimum, it should be clearly documented on the module page what Image toolkits are supported.

To add support in the future, you'll likely need to refactor the code to only call Image Toolkit methods that are defined in \Drupal\Core\ImageToolkit\ImageToolkitOperationManagerInterface. It seems that the getResource() method is unique to the GD2 toolkit and not part of the interface definition.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States nplowman

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

Comments & Activities

Production build 0.71.5 2024