yireo / Yireo_Webp2

Magento 2 module to add WebP support to Magento 2
Open Software License 3.0
194 stars 54 forks source link

Webp images are generated but only some are served. #118

Closed Bosecom closed 10 months ago

Bosecom commented 2 years ago

This was working fine before and after yesterdays update it fails to do the following.

This is a multistore instance of magento 2 and is a site for multiple running businesses

Magento 2.4.3 LEMP stack.

It fails to add the webp image to the website html and still only serves the jpg/png

Here are screenshots of the environment The website is https://hyper-fitness.co.uk the images in the brands slider on the homepage serve properly.

image you can see they serve fine:

image

but no other images are served: image

html:

image

if i go to the directory the cached images are found and the image exists:

"nextgenimages/"

also when I delete and re-add using cli i get this error even though the image permissions are 777(fortesting).

image

None of the category images or catalog pages work as they should and still only display png/jpg

I have tried: disabling all cache, flushing all cache, opcache, varnish, redis, cloudflare, fastcgi, nginx pagespeed. all are clear and I have reindexred with the same. I have configured nginx to serve webp wherever possible as well.

jissereitsma commented 2 years ago

Thanks for reporting this. I'm unable to duplicate your issues right away. And I therefor assume that this could be related as well to the other modules you are using.

Looking at your settings, it almost seems as if you went into the NextGenImages configuration to change some default settings. For instance, you mentioned the target directory nextgenimages/ while the default is not to use this (Target Directory equals Same filename as source image. Perhaps you can try with the original settings also?

Another thing to take in is that looking at the Element Inspector, you will not see the original DOM as sent by the server (so modified by this extension) but the DOM modified by JavaScript. The difference is that with galleries, swatch images and configurables the images created in HTML are anyway overwritten with ones in JavaScript. The earlier versions of this extension first loaded the WebP image, but then the JavaScript would place back all original JPG images as well, so that duplicate images were loaded. This newer version of the extension was supposed to fix this.

It fails to add the webp image to the website html and still only serves the jpg/png So some images are failing to load as WebP. Not all. For every image that it is failing, it seems there are various images around.

It seems this is a production environment. Were you able to confirm this too in a developer environment? And with the Developer Mode on? And with specific other extensions disabled, like the ones that are compressing HTML, the ones that are adding additional images (hidden-xs, visible-xs), etc. When a combination of extensions is causing a specific issue, usually it is part of the implementation to see which specific combination causes this.

also when I delete and re-add using cli i get this error even though the image permissions are 777(fortesting). Which error? Or do you mean the specific output being given by the command tool?

Bosecom commented 2 years ago

Thanks Jisse for your response,

I currently the website is in developer mode while I figure out how to optimise images. There is no HTML compression currently being activated. You can see this on the waterfall trace on the network tab(no minification or compression).

I changed the folder in hopes to test this (/nextgenimages) dir. I have tried to change them back but it did not work nor does it change back. I did try to uninstall and reinstall the module to see if that would make a difference. I have also checked other extensions but even the catalog pages do not work and those, although using a non magento(Mirasvit) layered navigation should still work.

There are a number of different plugins but i am really struggling to get this to work.

Thanks for your reply, I will continue to try to debug, I run di:compile after every change as well as clearning all caches.

Here are the settings in magento backend:

image

image

Bosecom commented 2 years ago

Hi Jisse,

Unfortunately I have had to disable the module as I cannot get it to work. Anymore information would be greatly appreciated.

Kindest Regards

Rob

jissereitsma commented 2 years ago

Thanks for letting me know. No one else reported this issue yet and I'm not able to reproduce this anywhere else. So my feeling is that this is related to your environment or your specific Magento implementation. Which one it is, is something that needs to be troubleshoot by someone. You mentioned already that your environment is based on LEMP and it includes Varnish, Redis, Cloudflare, Nginx Pagespeed and perhaps more. If somebody would ask me to troubleshoot anything in such an environment, step 1 would for me to duplicate the same issue in a local (!) - not a remote, but running on my PC - environment without Varnish, Redis, Cloudflare and Pagespeed. From your descriptions, I get the sense you have only tested this in 1 environment. So therefore I'm included to say that this is not related to this WebP extension perse, but related to a combination of all. For instance, Pagespeed is a tool to turn the original Magento HTML inside and out AND implement WebP. How do I not know that the problem you are describing is related to Pagespeed, instead of my extension? By testing it locally.

As of yet, I'm not sure what to do with this. Step 1 is to duplicate this environment locally and duplicate the issue. If the issue can't be duplicated, it is not the extension, not Magento, but the environment to blame. If the issue is duplicated, it is strange that it doesn't show in my environment. The difference is that I'm testing in a clean environment, you're testing it with dozens of other extensions that I don't know of. Which extension combination causes this? Disable them one by one and see how this works. I get the feeling that this type of troubleshooting is new to you, but realize that most Magento developers follow this pattern.

I will keep this ticket open, so you can add things to it. But unless the problem is analysed more deeply, I'm unable to do much more except concluding that this does not popup in my own enviroment.

CyberSecutor commented 1 year ago

Just my 2ct

looking at your console output the webp image has a double dot: <snip>933..webp

while the png is <snip>933.png

This probably leads to a mismatch. How this can happen, i don't know, just observing.

jissereitsma commented 10 months ago

I'm closing this ticket due to inactivity. Feel free to reopen if needed. It might have been a bug somewhere in the past, but currently I'm unable to see those double dots anywhere, and the issue seems to have gone stale.