Problem/Motivation
This is a follow-up of #3136443: Webp support. The compatibility with the webp module only works with use_imagecache_root disabled. The cause of this is that webp removes the original file extension.
This used to work with stage_file_proxy and this old patch:
https://www.drupal.org/project/stage_file_proxy/issues/3136443#comment-1...
It basically added some possible extensions to the paths, which is not ideal.
There is also this issue in the webp issue queue, which is about adding the original extension to the URLs and therefore fix the issue:
#3281606: Rendering duplicate images when the original images have the same name but different extension
Steps to reproduce
- Enable the use_imagecache_root configuration
- Try to load images generated with the webp module using stage_file_proxy
Proposed resolution
TBD
Remaining tasks
- Figure out if this should be solved in stage_file_proxy or the webp module.
User interface changes
None
API changes
None
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #29 | webp_compatibility_patch-3332930-29.patch.patch | 1.46 KB | kevinn |
| #17 | webp_compatibility_patch-3332930-9.patch | 520 bytes | dziabodo |
| #8 | webp_compatibility_patch-3332930-8.patch | 1.73 KB | neelam.chaudhary |
Issue fork stage_file_proxy-3332930
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
luksakComment #3
luksakComment #4
luksakComment #7
smustgrave commentedtried applying the old patch. Are you saying that works?
Comment #8
neelam.chaudhary commentedIf the webp generated images are available locally then the file_exists check returns TRUE and the the local image gets rendered but if the file has been uploaded and is supposed to render the first time then the webp file is not yet generated and the file_exists returns false and it redirects the url to remote.
This patch will check all the possible ext of images and if the image is found then it will not be a redirect and the local file is returned.
Comment #9
smustgrave commentedJust merged #3282542: Add a lock around retrieving upstream files could you test to see if you are still experiencing the issue on the dev branch?
The ProxySubscriber was deprecated in that merge.
Comment #10
deviantintegral commentedI just tested webp images and they work fine for me. However, it's not yet configured using responsive images in case that has something to do with triggering the bug.
Comment #13
godotislateOpened https://git.drupalcode.org/project/stage_file_proxy/-/merge_requests/34 for a different approach of using a local file entity query to find a matching local file entity URI for the imagecache root.
Comment #14
smustgrave commentedThank you @godotislate have you tried the latest 2.0.x dev branch to see if the issue still exits?
Comment #15
zcht commentedSounds similar to the problem: https://www.drupal.org/project/stage_file_proxy/issues/3326961
Comment #16
smustgrave commentedSo for patch #8 since it’s using a now deprecated approach can you test to see if the latest changes to 2.xdev fixes the issue
Same for the merge request. If the issue is still present then the MR needs to be rebased and then tested
Comment #17
dziabodo commentedHey,
The problem with webp is that we don't give drupal the ability to generate the image, when we invert the arrays and call webp first, drupal will capture the missing image and generate it.
Before Revers :
So we can do call first to image without webp and drupal has time for generate missing images.
Comment #18
smustgrave commented@dziabodo
Thank you just want to confirm the MR and current 2.0.x-dev did not fix it for you?
Comment #19
dziabodo commentedYeah @smustgrave, problem still existed, but after revers array images back
Comment #20
smustgrave commentedThank you for checking. Can someone confirm if $17 solves the issues for them? DOn't have webP setup locally or on any projects.
Comment #21
antoniya commented#17 solved the issue for us but I do have to note that we are using core's built-in convert effect for WebP image styles and not the contributed module (as described in the original issue for WebP support linked in the IS).
Comment #22
smustgrave commentedOkay if no objection by tomorrow I'll merge in #17. Will track under the Meta if we can get plenty of testing.
Comment #26
smustgrave commentedMerged #17. If still an issue please reopen!
If we can get heavy testing could probably do another release for https://www.drupal.org/project/stage_file_proxy/issues/3334239
Comment #27
smustgrave commentedWrong status.
Comment #29
kevinn commentedDon't get how you guys got this to work, the checkFileOrigin method is looking for:
public://example.webp
public://example
Which nether exists because the webp is being created by the webp module as a image style and of course public://example does not exist.
Here is a patch that checks for other file extensions.
Btw im using responsive images, maybe thats why it does not work for me.
Comment #30
luksakYes, same for me as described in #29. Could a maintainer re-open this please?
Comment #31
smustgrave commentedWould recommend opening a new ticket explaining your issue.
Comment #32
luksakOk, did so: #3349119: use_imagecache_root doesn't work with webp I used the exact same title and IS, since I am the creator of this issue as well. Feel free to change it accordingly.