An open API service indexing awesome lists of open source software.

https://github.com/etechflow/module-image-optimizer

Magento 2 server-side WebP image optimization. No external API, no per-image fees. Converts JPG/PNG/GIF locally via cwebp/Imagick/GD with graceful fallback. Emits <picture> + loading=lazy. Bulk + cron + CLI. Hyvä + Luma. Standalone or in the ETechFlow Bundle.
https://github.com/etechflow/module-image-optimizer

core-web-vitals ecommerce etechflow hyva hyva-compatible image-optimization lazy-load magento-2 magento-module magento2 magento2-module performance php webp

Last synced: 24 days ago
JSON representation

Magento 2 server-side WebP image optimization. No external API, no per-image fees. Converts JPG/PNG/GIF locally via cwebp/Imagick/GD with graceful fallback. Emits <picture> + loading=lazy. Bulk + cron + CLI. Hyvä + Luma. Standalone or in the ETechFlow Bundle.

Awesome Lists containing this project

README

          

# ETechFlow Image Optimizer

Server-side WebP image optimization for Magento 2. No external API, no per-image fees, no rate limits.

## Install

```bash
composer require etechflow/module-image-optimizer:^1.0
bin/magento module:enable ETechFlow_ImageOptimizer
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush
# Restart php-fpm to clear OPcache (mandatory on prod with opcache.validate_timestamps=0)
```

## Activate the licence

```bash
php tools/generate-license.php --module=image-optimizer --host=
```

Paste into **Stores → Configuration → eTechFlow → Image Optimizer → License Key** (or use the Bundle License Key if you're an ETechFlow suite customer).

## Verify

```bash
bin/magento etechflow:io:verify
```

Twelve PASS lines means you're good to go.

## Run the first bulk optimization

```bash
bin/magento etechflow:io:optimize
```

Walks `pub/media/catalog/product/cache/`, converts every JPEG/PNG to WebP. Resumable, idempotent, dedupes already-converted images.

After this finishes once, the `` block plugin starts emitting WebP variants automatically on every PDP / category page. New images cached by Magento are picked up on the next cron tick (every 5 min).

## How it works

Three pieces:

1. **Conversion engine chain** — tries `cwebp` binary first (fastest), then ImageMagick PHP extension, then PHP-GD. First available wins. No external API.
2. **Per-image `` block** — when Magento renders ``, our plugin wraps it: ``. WebP-capable browsers grab the smaller file; the rest get the JPEG. Universal compatibility.
3. **Bulk + cron CLI** — convert existing inventory once, then trust the cron to keep up with new images.

## Configuration

`Stores → Configuration → eTechFlow → Image Optimizer`:

- **License Key** — per-module key (or use Bundle License Key for the suite)
- **Module Enabled** — toggle the whole feature
- **Quality** — 1-100, default 80. Higher = larger files, marginal quality gain past ~85.
- **Conversion engine order** — pick which engines to try and in what order. Default: cwebp → Imagick → GD.
- **Image coverage** — which images to optimize: product catalog, search, cross-sells, CMS images, sliders.
- **Bulk batch size** — how many images per cron tick (default 200).

## Honest caveats

- Requires PHP-GD with WebP support **OR** Imagick with WebP support **OR** `cwebp` binary installed. Most modern hosts have at least one. Run `etechflow:io:verify` to confirm.
- Doubles the size of `pub/media/catalog/product/cache/` (JPEG + WebP coexist). Plan disk space accordingly — typically +25-40% growth.
- After the first bulk run, your CDN cache needs a purge to start serving the new HTML with `` tags.

## Compatibility

- Magento Open Source 2.4.4 – 2.4.8
- Adobe Commerce 2.4.4 – 2.4.8
- PHP 8.1 / 8.2 / 8.3 / 8.4
- Hyvä Theme + Hyvä Checkout
- Luma theme

## Support

info@etechflow.com — include your license key + Magento version when reporting issues.