Only public images are supported, not private ones. As I did not see any mention of this limitation, I guess it's a bug and not a feature request.
I seems very easy to add this support, it's just that the controller override is done only for public images, but the controller is the same for private ones so it could be easily overridden too. The new controller seems to already have the access logic for private files, copied from the parent method.
A patch is coming.

Issue fork webp-3143491

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

GaëlG created an issue. See original summary.

GaëlG’s picture

Status: Active » Needs review
FileSize
772 bytes

Patch attached.

I made a simple test on a private image field on an unpublished content: the image is successfully displayed to admin users but cannot be accessed by an anonymous user, which has no access to the corresponding content.

alexmoreno’s picture

LGTM, thanks for this @GaëlG

ericdsd’s picture

Patch #2 work fine, thanks.

alexmoreno’s picture

Status: Needs review » Reviewed & tested by the community
GaëlG’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
5.35 KB

Actually the webp file got regenerated each time it was requested. Here's an updated patch to fix that performance issue.

GaëlG’s picture

alexmoreno’s picture

Status: Needs review » Reviewed & tested by the community
alexmoreno’s picture

Status: Reviewed & tested by the community » Needs review
alexmoreno’s picture

Status: Needs review » Needs work

this needs reroll as the patch does not apply anymore against the dev branch

mrinalini9’s picture

Status: Needs work » Needs review
FileSize
6.1 KB

Rerolled patch #7, please review.

alexmoreno’s picture

@GaëlG the new patch introduces lock capability. While I am not against it and seems super cool it seems out of the scope of this issue. I want to test this isolated so we make sure it works as intended and does not introduce any issues. I may take some more time to review it.

On any case, thanks a lot for this cool feature

GaëlG’s picture

@alexmoreno Thank you for the review. The patch in #2 still applies and does not have the lock capability. I created a separate issue for that: #3177103: Do not regenerate the webp file each time it is requested

GaëlG’s picture

GaëlG’s picture

Patch #2 did not handle the webp version of an unstyled private image. This one does.

alexmoreno’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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