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.
Comment | File | Size | Author |
---|---|---|---|
#15 | 3143491-interdiff-2-to-15.txt | 8.51 KB | GaëlG |
#15 | 3143491-15.patch | 8.88 KB | GaëlG |
#2 | webp-private_support-3143491-2.patch | 772 bytes | GaëlG |
Issue fork webp-3143491
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
Comment #2
GaëlGPatch 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.
Comment #3
alexmoreno CreditAttribution: alexmoreno commentedLGTM, thanks for this @GaëlG
Comment #4
ericdsd CreditAttribution: ericdsd commentedPatch #2 work fine, thanks.
Comment #5
alexmoreno CreditAttribution: alexmoreno commentedComment #6
GaëlGActually the webp file got regenerated each time it was requested. Here's an updated patch to fix that performance issue.
Comment #7
GaëlGComment #8
alexmoreno CreditAttribution: alexmoreno commentedComment #9
alexmoreno CreditAttribution: alexmoreno commentedComment #10
alexmoreno CreditAttribution: alexmoreno commentedthis needs reroll as the patch does not apply anymore against the dev branch
Comment #11
mrinalini9 CreditAttribution: mrinalini9 at Srijan | A Material+ Company for Drupal India Association commentedRerolled patch #7, please review.
Comment #12
alexmoreno CreditAttribution: alexmoreno commented@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
Comment #13
GaëlG@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
Comment #14
GaëlGComment #15
GaëlGPatch #2 did not handle the webp version of an unstyled private image. This one does.
Comment #18
alexmoreno CreditAttribution: alexmoreno commented