From af52815442ae5c8554b5cb588ae588eeced96f00 Mon Sep 17 00:00:00 2001 From: jisse Reitsma Date: Fri, 22 Sep 2023 12:55:35 +0200 Subject: [PATCH] Merge all docs --- FAQ.md | 61 -------------------- INSTALL.md | 30 ---------- PWA.md | 2 - README.md | 162 ++++++++++++++++++++++++++++++++++++++++++++++++++--- SUPPORT.md | 44 --------------- TESTING.md | 7 --- USAGE.md | 35 ------------ 7 files changed, 154 insertions(+), 187 deletions(-) delete mode 100644 FAQ.md delete mode 100644 INSTALL.md delete mode 100644 PWA.md delete mode 100644 SUPPORT.md delete mode 100644 TESTING.md delete mode 100644 USAGE.md diff --git a/FAQ.md b/FAQ.md deleted file mode 100644 index b675c15..0000000 --- a/FAQ.md +++ /dev/null @@ -1,61 +0,0 @@ -# How do I know WebP is used? -Make sure to test things with the obvious caches disabled (Full Page Cache, Block HTML Cache). Once this extension is working, catalog images (like on a category page) should be replaced with: Their `` tag should be replaced with a `` tag that lists both the old image and the new WebP image. If the conversion from the old image to WebP goes well. - -You can expect the HTML to be changed, so inspecting the HTML source gives a good impression. You can also use the Error Console to inspect network traffic: If some `webp` images are flying be in a default Magento environment, this usually proofs that the extension is working to some extent. - -# My CPU usage goes up. Is that normal? -Yes, it is normal. This extension does two things: It shows a WebP on the frontend of your shop. And it -generates that WebP when it is missing. Obviously, generating an image takes up system resources. And if -you have a large catalog, it is going to do more time. How much time? Do make sure to calculate this -yourself: Take an image, resize it using the `cwebp` binary and measure the time - multiply it by how many -images there are. This should give a fair estimation on how much time is needed. - -Note that this extension allows for using various mechanisms (aka *convertors*). Tune the **Convertors** -settings if you want to try to optimize things. Sometimes, GD is faster than `cwebp`. Sometimes, GD just -breaks things. It depends, so you need to pick upon the responsibility to try this in your specific -environment. - -Also note that this extension allows for setting an *encoding*. The default is `auto` which creates both a lossy and a lossless WebP and then picks the smallest one. Things could be twice as fast by setting this to `lossy`. - -If you don't like the generation of images at all, you could also use other CLI tools instead. - -# Class 'WebPConvert\WebPConvert' not found -We only support the installation of our Magento 2 extensions, if they are installed via `composer`. Please note that - as we see it - `composer` is the only way for managing Magento depedencies. If you want to install the extension manually in `app/code`, please study the contents of `cmoposer.json` to install all dependencies of this module manually as well. - -# After installation, I'm still seeing only PNG and JPEG images -This could mean that the conversion failed. New WebP images are stored in the same path as the original path (somewhere in `pub/`) which means that all folders need to be writable by the webserver. Specifically, if your deployment is based on artifacts, this could be an issue. - -Also make sure that your PHP environment is capable of WebP: The function `imagewebp` should exist in PHP and we recommend a `cwebp` binary to be placed in `/usr/local/bin/`. - -Last but not least, WebP images only work in WebP-capable browsers. The extension detects the browser support. Make sure to test this in Chrome first, which natively supports WebP. - -# Warning: filesize(): stat failed for xxx.webp -If you are seeing this issue in the `exception.log` and/or `system.log`, -do make sure to wipe out Magento caching and do make sure that the WebP -file in question is accessible: The webserver running Magento should have -read access to the file. Likewise, if you want this extension to -automatically convert a JPEG into WebP, do make sure that the folder -containing the JPEG is writable. - -# Some of the images are converted, but others are not. -Not all JPEG and PNG images are fit for conversion to WebP. In the past, WebP has had issues with alpha-transparency and partial transparency. If the WebP image can't be generated by our extension, it is not generated. Simple as that. If some images are converted but some are not, try to upload those to online conversion tools to see if they work. - -Make sure your `cwebp` binary and PHP environment are up-to-date. - -# This sucks. It only works in some browsers. -Don't complain to us. Instead, ask the other browser vendors to support this as well. And don't say this -is not worth implementing, because I bet more than 25% of your sites visitors will benefit from WebP. Not -offering this to them, is wasting additional bandwidth. - -# Some emails are also displaying WebP -It could be that your transactional email templates are including XML layout handles that suddenly introduce this extensions functionality, while actually adding WebP to emails is a bad idea (because most email clients will not support anything of the like). - -If you encounter such an email, find out which XML layout handle is the cause of this (`{handle layout="foobar"}`). Next, create a new XML layout file with that name (`foobar.xml`) and call the `webp_skip` handle from it (``). So this instructs the WebP extension to skip loading itself. - -# error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory -Ask your system administrator to install this library. Or ask the system administrator to install WebP support in PHP by upgrading PHP itself to the right version and to include the right PHP modules (like imagemagick). Or skip converting WebP images by disabling the setting in our extension and then convert all WebP images by hand. - -# Can I use this with Amasty Shopby? -Yes, you can. Make sure to install the addition https://github.com/yireo/Yireo_Webp2ForAmastyShopby as well. - - diff --git a/INSTALL.md b/INSTALL.md deleted file mode 100644 index 494b90e..0000000 --- a/INSTALL.md +++ /dev/null @@ -1,30 +0,0 @@ -# Instructions for using composer -Use composer to install this extension. First make sure that Magento is installed via composer, and that there is a valid `composer.json` file present. - -Next, install our module using the following command: - - composer require yireo/magento2-webp2 - -Next, install the new module plus its dependency `Yireo_NextGenImages` into Magento itself: - - ./bin/magento module:enable Yireo_Webp2 Yireo_NextGenImages - ./bin/magento setup:upgrade - -Enable the module by toggling the setting in **Stores > Configuration > Yireo > Yireo WebP > Enabled**. - -# Instructions for using ExtDN installer -First install the ExtDN installer: - - wget https://github.com/extdn/installer-m2/raw/master/build/extdn_installer.phar - chmod 755 extdn_installer.phar - -We recommend moving the PHAR file to a global location like `/usr/local/bin/extdn_installer`: - - sudo mv extdn_installer.phar /usr/local/bin/extdn_installer - -Next, install this extension: - - extdn_installer install yireo/magento2-webp2 - -Done. - diff --git a/PWA.md b/PWA.md deleted file mode 100644 index 9fcbc0b..0000000 --- a/PWA.md +++ /dev/null @@ -1,2 +0,0 @@ -# PWA compatibility -This frontend extension will be completely replaced by React or Vue functionality, and therefore, this extension will not be made compatible with PWA. diff --git a/README.md b/README.md index 08148f5..9bbe55c 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,160 @@ # Magento 2 module for WebP -This module adds WebP support to Magento 2. +**This module adds WebP support to Magento 2.** -## See also: -- [Usage](USAGE.md) -- [Installation](INSTALL.md) -- [FAQ](FAQ.md) -- [Support](SUPPORT.md) -- [TODO](TODO.md) +## About this module +- When `` tags are found on the page, the corresponding JPG or PNG is converted into WebP and a corresponding `` tag. +- The Fotorama gallery of the Magento core product pages is replaced with WebP images without issues as well. However, the Fotorama effect loads new JPG images again, replacing the original `` tag. This shows that the Fotorama library is not scalable and may be a bad decision to use. We recommend you replace it with the [Notorama](https://github.com/robaimes/module-notorama) module instead. + +Hyvä support is built into the latest versions of this module. Please do not use the deprecated compatibility module anymore. + +## Instructions for using composer +Use composer to install this extension. Not using composer is **not** supported. Next, install the new module plus its dependency `Yireo_NextGenImages` into Magento itself: + +```bash +composer require yireo/magento2-webp2 +bin/magento module:enable Yireo_Webp2 Yireo_NextGenImages +bin/magento setup:upgrade +``` + +Enable the module by toggling the setting in **Stores > Configuration > Yireo > Yireo WebP > Enabled**. + +## System requirements +Make sure your PHP environment supports WebP: This means that the function `imagewebp` should exist in PHP. We hope to add +more checks for this in the extension itself soon. For now, just open up a PHP `phpinfo()` page and check for WebP +support. Please note that installing `libwebp` on your system is not the same as having PHP support WebP. Check the +`phpinfo()` file and add new PHP modules to PHP if needed. If in doubt, simple create a PHP script `test.php` and a line +`` tag should be replaced with a `` tag that lists both the old image and the new WebP image. If the conversion from the old image to WebP goes well. + +You can expect the HTML to be changed, so inspecting the HTML source gives a good impression. You can also use the Error Console to inspect network traffic: If some `webp` images are flying be in a default Magento environment, this usually proofs that the extension is working to some extent. + +#### My CPU usage goes up. Is that normal? +Yes, it is normal. This extension does two things: It shows a WebP on the frontend of your shop. And it +generates that WebP when it is missing. Obviously, generating an image takes up system resources. And if +you have a large catalog, it is going to do more time. How much time? Do make sure to calculate this +yourself: Take an image, resize it using the `cwebp` binary and measure the time - multiply it by how many +images there are. This should give a fair estimation on how much time is needed. + +Note that this extension allows for using various mechanisms (aka *convertors*). Tune the **Convertors** +settings if you want to try to optimize things. Sometimes, GD is faster than `cwebp`. Sometimes, GD just +breaks things. It depends, so you need to pick upon the responsibility to try this in your specific +environment. + +Also note that this extension allows for setting an *encoding*. The default is `auto` which creates both a lossy and a lossless WebP and then picks the smallest one. Things could be twice as fast by setting this to `lossy`. + +If you don't like the generation of images at all, you could also use other CLI tools instead. + +#### Class 'WebPConvert\WebPConvert' not found +We only support the installation of our Magento 2 extensions, if they are installed via `composer`. Please note that - as we see it - `composer` is the only way for managing Magento depedencies. If you want to install the extension manually in `app/code`, please study the contents of `cmoposer.json` to install all dependencies of this module manually as well. + +#### After installation, I'm still seeing only PNG and JPEG images +This could mean that the conversion failed. New WebP images are stored in the same path as the original path (somewhere in `pub/`) which means that all folders need to be writable by the webserver. Specifically, if your deployment is based on artifacts, this could be an issue. + +Also make sure that your PHP environment is capable of WebP: The function `imagewebp` should exist in PHP and we recommend a `cwebp` binary to be placed in `/usr/local/bin/`. + +Last but not least, WebP images only work in WebP-capable browsers. The extension detects the browser support. Make sure to test this in Chrome first, which natively supports WebP. + +#### Warning: filesize(): stat failed for xxx.webp +If you are seeing this issue in the `exception.log` and/or `system.log`, +do make sure to wipe out Magento caching and do make sure that the WebP +file in question is accessible: The webserver running Magento should have +read access to the file. Likewise, if you want this extension to +automatically convert a JPEG into WebP, do make sure that the folder +containing the JPEG is writable. + +#### Some of the images are converted, but others are not. +Not all JPEG and PNG images are fit for conversion to WebP. In the past, WebP has had issues with alpha-transparency and partial transparency. If the WebP image can't be generated by our extension, it is not generated. Simple as that. If some images are converted but some are not, try to upload those to online conversion tools to see if they work. + +Make sure your `cwebp` binary and PHP environment are up-to-date. + +#### This sucks. It only works in some browsers. +Don't complain to us. Instead, ask the other browser vendors to support this as well. And don't say this +is not worth implementing, because I bet more than 25% of your sites visitors will benefit from WebP. Not +offering this to them, is wasting additional bandwidth. + +#### Some emails are also displaying WebP +It could be that your transactional email templates are including XML layout handles that suddenly introduce this extensions functionality, while actually adding WebP to emails is a bad idea (because most email clients will not support anything of the like). + +If you encounter such an email, find out which XML layout handle is the cause of this (`{handle layout="foobar"}`). Next, create a new XML layout file with that name (`foobar.xml`) and call the `webp_skip` handle from it (``). So this instructs the WebP extension to skip loading itself. + +#### error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory +Ask your system administrator to install this library. Or ask the system administrator to install WebP support in PHP by upgrading PHP itself to the right version and to include the right PHP modules (like imagemagick). Or skip converting WebP images by disabling the setting in our extension and then convert all WebP images by hand. + +#### Can I use this with Amasty Shopby? +Yes, you can. Make sure to install the addition https://github.com/yireo/Yireo_Webp2ForAmastyShopby as well. ## Requesting support -Feel free to open an **Issue** here on GitHub. However, do make sure to be thorough. See [SUPPORT.md](SUPPORT.md) for further details. + +### First check to see if our extension is doing its job +Before requesting support, please make sure that you properly check whether this extension is working or not. Do not look at your browser and definitely do not use third party SEO tools to make any conclusions. Instead, inspect the HTML source in your browser. Our extension modifies the HTML so that regular `` tags are replaced with something similar to the following: +```html + + + + + +``` + +If similar HTML is there, but your browser is not showing the WebP image, then realize that this is not due to our extension, but due to your browser. Unfortunately, we are not browser manufacturers and we can't change this. Refer to https://caniuse.com/#search=webp instead. + +### Opening an issue for this extension +Feel free to open an **Issue** in the GitHub project of this extension. However, do make sure to be thorough and provide as many details as you can: + +- What browser did you test this with? +- What is your Magento version? +- What is your PHP version? +- Did you make sure to use `composer` to install all dependencies? + - Not using `composer` is **not** supported. +- Which specific composer version of the Yireo WebP2 extension did you install? +- Which specific composer version of the Yireo NextGenImages extension did you install? +- Have you tested this after flushing all caches, especially the Full Page Cache? +- Have you tested this after disabling all caches, especially the Full Page Cache? + - The Full Page Cache will prevent you from seeing dynamic results. The Full Page Cache works with our extension, it just pointless to troubleshoot things with FPC enabled, unless you are troubleshooting FPC itself. +- Are you testing this in the Developer Mode or in the Production Mode? + - We recommend you to use the Developer Mode. Do not use the Default Mode anywhere. Do not use the Production Mode to make modifications to Magento. +- Under **Stores > Configuration > Yireo > Yireo WebP2** and **Stores > Configuration > Yireo > Yireo NextGenImages**, what settings do you see with which values? + - Preferably post a screenshot with the settings. +- Could you supply a URL to a live demo? +- Could you please supply a snapshot of the HTML source of a product page? + +Please note that we do not support Windows to be used to run Magento. Magento itself is not supporting Windows either. If you are stuck with Windows, make sure to use the WSL (Windows Subsystem for Linux) and use the Linux layer instead. + +If the WebP configuration section is showing in the backend, but the HTML source in the frontend is not modified, please send the output of the command `bin/magento dev:di:info "\Magento\Framework\View\LayoutInterface"`. + +### Issues with specific images +If some images are converted but others are not, please supply the following details: + +- The output of the command `bin/magento next-gen-images:test-uri $URL` where `$URL` is the URL to the original image (JPG or PNG) +- The output of the command `bin/magento next-gen-images:convert $PATH` where `$PATH` is the absolute path to the original image (JPG or PNG) +- Whether or not you are using a CDN for serving images. diff --git a/SUPPORT.md b/SUPPORT.md deleted file mode 100644 index ba07741..0000000 --- a/SUPPORT.md +++ /dev/null @@ -1,44 +0,0 @@ -# Requesting support - -## First check to see if our extension is doing its job -Before requesting support, please make sure that you properly check whether this extension is working or not. Do not look at your browser and definitely do not use third party SEO tools to make any conclusions. Instead, inspect the HTML source in your browser. Our extension modifies the HTML so that regular `` tags are replaced with something similar to the following: -```html - - - - - -``` - -If similar HTML is there, but your browser is not showing the WebP image, then realize that this is not due to our extension, but due to your browser. Unfortunately, we are not browser manufacturers and we can't change this. Refer to https://caniuse.com/#search=webp instead. - -## Opening an issue for this extension -Feel free to open an **Issue** in the GitHub project of this extension. However, do make sure to be thorough and provide as many details as you can: - -- What browser did you test this with? -- What is your Magento version? -- What is your PHP version? -- Did you make sure to use `composer` to install all dependencies? - - Not using `composer` is **not** supported. -- Which specific composer version of the Yireo WebP2 extension did you install? -- Which specific composer version of the Yireo NextGenImages extension did you install? -- Have you tested this after flushing all caches, especially the Full Page Cache? -- Have you tested this after disabling all caches, especially the Full Page Cache? - - The Full Page Cache will prevent you from seeing dynamic results. The Full Page Cache works with our extension, it just pointless to troubleshoot things with FPC enabled, unless you are troubleshooting FPC itself. -- Are you testing this in the Developer Mode or in the Production Mode? - - We recommend you to use the Developer Mode. Do not use the Default Mode anywhere. Do not use the Production Mode to make modifications to Magento. -- Under **Stores > Configuration > Yireo > Yireo WebP2** and **Stores > Configuration > Yireo > Yireo NextGenImages**, what settings do you see with which values? - - Preferably post a screenshot with the settings. -- Could you supply a URL to a live demo? -- Could you please supply a snapshot of the HTML source of a product page? - -Please note that we do not support Windows to be used to run Magento. Magento itself is not supporting Windows either. If you are stuck with Windows, make sure to use the WSL (Windows Subsystem for Linux) and use the Linux layer instead. - -If the WebP configuration section is showing in the backend, but the HTML source in the frontend is not modified, please send the output of the command `bin/magento dev:di:info "\Magento\Framework\View\LayoutInterface"`. - -## Issues with specific images -If some images are converted but others are not, please supply the following details: - -- The output of the command `bin/magento next-gen-images:test-uri $URL` where `$URL` is the URL to the original image (JPG or PNG) -- The output of the command `bin/magento next-gen-images:convert $PATH` where `$PATH` is the absolute path to the original image (JPG or PNG) -- Whether or not you are using a CDN for serving images. \ No newline at end of file diff --git a/TESTING.md b/TESTING.md deleted file mode 100644 index c94474d..0000000 --- a/TESTING.md +++ /dev/null @@ -1,7 +0,0 @@ -# Testing -This extension ships with Integration Tests (`Test/Integration/`) and a Travis CI build (`.travis.yml` which triggers scripts in `.ci-scripts/`). The CI scripts can be tested locally with the `Dockerfile`: - - docker build -t ci . - docker-compose up --build --abort-on-container-exit - - diff --git a/USAGE.md b/USAGE.md deleted file mode 100644 index 8243d1d..0000000 --- a/USAGE.md +++ /dev/null @@ -1,35 +0,0 @@ -# About this module -- When `` tags are found on the page, the corresponding JPG or PNG is converted into WebP and a corresponding `` tag. -- The Fotorama gallery of the Magento core product pages is replaced with WebP images without issues as well. However, the Fotorama effect loads new JPG images again, replacing the original `` tag. This shows that the Fotorama library is not scalable and may be a bad decision to use. We recommend you replace it with the [Notorama](https://github.com/robaimes/module-notorama) module instead. - -# System requirements -Make sure your PHP environment supports WebP: This means that the function `imagewebp` should exist in PHP. We hope to add -more checks for this in the extension itself soon. For now, just open up a PHP `phpinfo()` page and check for WebP -support. Please note that installing `libwebp` on your system is not the same as having PHP support WebP. Check the -`phpinfo()` file and add new PHP modules to PHP if needed. If in doubt, simple create a PHP script `test.php` and a line -`