Installation
Requirements
Section titled “Requirements”- CS-Cart or CS-Cart Multi-Vendor 4.17.2 – 4.21.x (tested on CS-Cart Ultimate 4.17.2 with PHP 8.1, Multi-Vendor 4.17.2 with PHP 8.1 and Multi-Vendor 4.21.2 with PHP 8.3).
- PHP 7.2.5 – 8.3, as supported by your CS-Cart version.
- At least one way to write WebP or AVIF with PHP: the GD extension with WebP support (standard on most hosts), or Imagick. AVIF needs PHP 8.1 or newer with AVIF in GD, or Imagick with AVIF. The add-on checks this for you (see Server support).
- No external programs and no
exec(): hosts that disable shell functions are fine. - The images of the store on the server’s file system (the default). A CDN in front of the store works.
- Disk space for the copies: roughly half to two thirds of the size of your
images/folder for WebP and AVIF together (copies that would not be smaller are not kept). - No other add-on is required.
Install
Section titled “Install”- Go to Add-ons → Manage add-ons, click the gear button and choose Manual installation.
- Upload
kv_image_optimizer_webp-<version>.zipand click Upload & install. - On the License tab of the settings, enter your license key and save. If you bought the add-on on the CS-Cart Marketplace and entered the license number in Add-ons → Manage add-ons, you can skip this step. Until a key is verified, the add-on works for 14 days (see License).
- Open Website → Image optimizer and click Optimise now. The page scans the
images/folder and converts the images in short batches with a progress bar. You can leave the page at any time: the work continues later. - Recommended for larger catalogs: add the cron line shown on the page (for example every 15 minutes). Without cron, the add-on works in short background batches while an administrator uses the admin panel.
Installation creates one table (cscart_kv_iow_files, the list of images with their sizes and status). The copies go to images/kv_image_optimizer_webp/, work files and backups to var/kv_image_optimizer_webp/. No core files, core tables or original images are changed.
Right after installing, the storefront still shows the original images: an image gets its WebP/AVIF sources as soon as its copies exist. Lazy loading and the priority of the main product image work at once.
Upgrade
Section titled “Upgrade”Upload the new package over the installed add-on (same steps as installing). On the next admin page load the add-on brings its table, settings and language variables up to date by itself. The copies, the statistics and the backups of compressed originals are kept.
Disable
Section titled “Disable”Disabling the add-on (status Off) makes the storefront show the original images again without any change to the markup. The copies stay on disk and are used again when you turn the add-on back on. To keep the add-on active but stop serving the copies, set Serve optimised images to Off.
Uninstall
Section titled “Uninstall”Add-ons → Manage add-ons → Image Optimizer (WebP/AVIF & Lazy Load) → gear → Uninstall:
- puts every original that Compress original images rewrote back from its backup (an image you replaced since then is kept as it is);
- deletes all WebP and AVIF copies (
images/kv_image_optimizer_webp/) and the work files (var/kv_image_optimizer_webp/); - removes the table, the settings and the language variables.
Your original images, thumbnails and all other store data are never deleted. For a very large number of compressed originals, run Restore originals on the image optimizer page first, so the uninstall itself has little to do.