Yireo_Webp2 icon indicating copy to clipboard operation
Yireo_Webp2 copied to clipboard

Webp image is occasionally different than Jpeg source

Open KimballShop opened this issue 5 years ago • 11 comments

Webp is 0.10.5, Magento is 2.3.4, PHP is 7.1.33, nextGen is 0.2.1 We have noticed that the Webp thumbnails that come up on a search for a few products are incorrect, while the jpg originals are correct - this is checked with Internet Explorer vs Chrome or Edge. This seems to have happened with certain sets of products when they were set up in Magento, so it may have been specific to a few days. We were using 0.7.7 at the time. We have cleared the cache several times. The products with the wrong thumbnail are using thumbnails from a product with a similar name. I originally installed with Composer, but an outside web developer made some changes without using Composer (which I found out when I tried an uninstall). I haven't tested this in development mode or by flushing full page cache. I'd like some guidance on how I can debug this further, or fix it. As this is an intermittent issue, it's hard to say if the upgrade to 0.10.5 fixed anything. Here's some image URLs, the ones from IE (Internet Explorer) are correct: Chrome https://kimballshop.com/pub/media/catalog/product/cache/78bfa443a549d807f8e5d2907d4d9c3d/rdi/rdi/hand-towel-lotus-m008-h_1.webp IE https://kimballshop.com/pub/media/catalog/product/cache/78bfa443a549d807f8e5d2907d4d9c3d/rdi/rdi/hand-towel-lotus-m008-h_1.jpg

Chrome https://kimballshop.com/pub/media/catalog/product/cache/78bfa443a549d807f8e5d2907d4d9c3d/rdi/rdi/bath-towel-lotus-m008-b_1.webp IE https://kimballshop.com/pub/media/catalog/product/cache/78bfa443a549d807f8e5d2907d4d9c3d/rdi/rdi/bath-towel-lotus-m008-b_1.jpg

Chrome https://kimballshop.com/pub/media/catalog/product/cache/78bfa443a549d807f8e5d2907d4d9c3d/rdi/rdi/hand-stitched-gray-coverlet-cv-gray_1.webp IE https://kimballshop.com/pub/media/catalog/product/cache/78bfa443a549d807f8e5d2907d4d9c3d/rdi/rdi/hand-stitched-gray-coverlet-cv-gray_1.jpg

Chrome https://kimballshop.com/pub/media/catalog/product/cache/78bfa443a549d807f8e5d2907d4d9c3d/rdi/rdi/sham-white-sh-white_1.webp IE https://kimballshop.com/pub/media/catalog/product/cache/78bfa443a549d807f8e5d2907d4d9c3d/rdi/rdi/sham-white-sh-white_1.jpg

KimballShop avatar Apr 05 '21 18:04 KimballShop

Thanks for addressing this. I assume that you are upgrading PHP today or tomorrow, because if you worry about conversion, upgrading PHP to PHP 7.3 (or preferably Magento 2.4 and PHP 7.4) gives the real boost, not a silly extension like this.

The WebP extension scans for the timestamp of the original image, to determine whether or not the original image is newer than the WebP version. Could you verify those timestamps? Also, could you try to remove one JPG, reload the page and see if it fixed things? What is the filesystem type of the folder where the images are stored?

jissereitsma avatar Apr 06 '21 05:04 jissereitsma

Hello!

A similar situation. It appeared when the managers removed the picture for the product and then added another picture again.

Use version: 0.10.7 Screenshot 2021-07-01 142910

dontbug avatar Jul 01 '21 11:07 dontbug

Could you upgrade to the latest version to make sure things are not related to older versions?

If the images are different, could you check the timestamps of the images via the filesystem? Is indeed the JPG newer than the WebP? And what kind of filesystem is this? Could you also confirm that there is no CDN in between?

jissereitsma avatar Jul 02 '21 06:07 jissereitsma

  • image timestamps: image
  • filesystem: root - xfs /boot - ext2
  • no CDN

We analyzed just the commits, and noticed that there are no changes (if we are not mistaken) between the latest version and ours, which is associated with this problem. But we will try to update as soon as possible.

dontbug avatar Jul 02 '21 08:07 dontbug

Thanks. So the timestamps are different and the extension should be picking up on this.

Is the Full Page Cache enabled? Because if that's the fact, than the WebP extension is never called upon again, so it is impossible to check whether the WebP image needs updating ...

jissereitsma avatar Jul 02 '21 09:07 jissereitsma

No. is disabled image

dontbug avatar Jul 02 '21 09:07 dontbug

Test this scenario:

  1. For product X with existing 3 pictures, try deleting 2 pictures and click save
  2. Add 2 new pictures for this picture and click save. And check if the JPEG / WEBP pictures are different.

dontbug avatar Jul 02 '21 09:07 dontbug

Could you check whether the NextGenImages setting "Convert images on save" is at its default "No" or changed into "Yes"?

jissereitsma avatar Jul 11 '21 18:07 jissereitsma

Could you check whether the NextGenImages setting "Convert images on save" is at its default "No" or changed into "Yes"?

Screenshot 2021-07-12 105740

dontbug avatar Jul 12 '21 07:07 dontbug

Hi all. This happened to me in limited cases.

Steps to reproduce:

  • Create product A with image image.png
  • Create product B with image image.jpg (notice that product image is same in both, only extension is different)

First product loaded on catalog page will generate .webp variant and other product will use it. Maybe a new filename for next gen images should be image.jpg.webp ? Anyone have better idea? This happens more often in merchants who manually upload product images and name them poorly.

Debug update: Poke around convertSuffix logic in yireo/Yireo_NextGenImages/Image/File.php return (string)preg_replace('/.(jpg|jpeg|png)/i', $destinationSuffix, $sourceFilename); return (string)preg_replace('/.(jpg|jpeg|png)/i', '.$1' .$destinationSuffix, $sourceFilename);

nkajic avatar Jan 20 '22 10:01 nkajic

A few days ago, version 0.3.0 of the NextGenImages module was released with a feature to name the WebP image (or other future nextgen images) with a hash. I guess this would solve things for some of you. Let me know if issues still arise after the upgrade to that version.

jissereitsma avatar May 09 '22 18:05 jissereitsma