Problem/Motivation

When calling the rotate operation through the image factory, the operation always fails because the "rotate" operation no longer exists following the work done in #3251438: Deprecate the Rotate operation class

Steps to reproduce

Attempt to call the rotate method through the image factory while the imagemagick toolkit is being used:

// Sample snippet to showcase the failure.
/** @var \Drupal\Core\Image\ImageFactory $image_factory */
$image_factory = \Drupal::service('image.factory');
$image = $image_factory->get('public://image.jpg');
// This currently fails.
var_dump($image->rotate(90));

Proposed resolution

Use the rotate_ie operation defined in the image_effect module whenever the rotate operation is requested.

Remaining tasks

Provide issue fork.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

codebymikey created an issue. See original summary.

codebymikey’s picture

Issue summary: View changes
Status: Active » Needs review
mondrake’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Thanks

I wonder whether we should detect whether the rotate_ie plugin is available before swapping the operation.

Either way, we need a small test to prove this works and to prevent future regressions.

codebymikey’s picture

I wonder whether we should detect whether the rotate_ie plugin is available before swapping the operation.

Yes, or better yet, check if the rotate plugin exists first, before falling back to rotate_ie (just in case it's been implemented in a specific installation)

codebymikey’s picture

Status: Needs work » Needs review

Created the tests, the CI config for 5.0.x needs updating in order to ensure tests can run.

mondrake’s picture

Status: Needs review » Needs work

Tests now work... but fail. It may be me having broken them...

mondrake’s picture

Status: Needs work » Fixed
Issue tags: -Needs tests

Fixed the tests and committed to 5.0.x. Thanks.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.