Problem/Motivation

Error:
Call to undefined method Drupal\system\Plugin\ImageToolkit\GDToolkit::getResource()
/mysite/modules/contrib/imageapi_optimize_webp/src/Plugin/ImageAPIOptimizeProcessor/WebP.php:25

Uncaught PHP Exception Error: "Call to undefined method Drupal\system\Plugin\ImageToolkit\GDToolkit::getResource()" at WebP.php line 25

Steps to reproduce

Click to edit style in https://mysite.com/admin/config/media/image-styles
Second click doesn't generate this error...

I use ImageMagic module 4.0.2.

CommentFileSizeAuthor
#3 imageapi_optimize_webp_v3_3504713.patch807 bytesgillesv
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

superfedya created an issue. See original summary.

gillesv’s picture

Experiencing the same issue. I'm guessing it's related to the deprecation of the "getResource" function?
https://www.drupal.org/node/3265963

gillesv’s picture

StatusFileSize
new807 bytes

I changed "getResource" to "getImage" in WebP.php, and that seems to do the trick. Patch attached for v3.x.

lazysoundsystem’s picture

Status: Active » Reviewed & tested by the community

Confirming that v2.1.0 does not work with Drupal 11 due to this issue (see also https://api.drupal.org/api/drupal/core%21modules%21system%21src%21Plugin...)

v3.0.0-alpha2 does work with Drupal 11 but is still in alpha - would be nice to make a new release for v2.1 with this change (so that it really is compatible with D11) or make a stable v3 release. Or both!

duwid made their first commit to this issue’s fork.

duwid changed the visibility of the branch 3504713-call-to-undefined to hidden.

phjou’s picture

emixaam’s picture

Patch from #3 work well with Drupal 11.3. Tested on multiple environments.

jlj’s picture

Same issue, patch #3 work for me too. Thx.

michaellander’s picture

I've pushed up a beta for 3.x. I'd like to get people moved over to that but am more than willing to update 2.1 in the meantime. Can we get the patch moved into a fork/branch with an MR?

michaellander changed the visibility of the branch 3504713-undefined-method-getResource to hidden.

michaellander changed the visibility of the branch 3504713-call-to-undefined to active.

michaellander changed the visibility of the branch 3504713-call-to-undefined to hidden.

michaellander changed the visibility of the branch 3504713-undefined-method-getResource to active.

michaellander changed the visibility of the branch 3504713-undefined-method-getResource to hidden.