# Image optimizer plugin

> Install the Reggio Image Optimizer on a WordPress site, connect it with a key, and control what it converts, how visitors get the smaller images and how to undo it.

Source: https://reggiodigital.com/developers/image-optimizer

The Reggio Image Optimizer is a WordPress plugin that makes a smaller WebP copy of each image in the media library, and AVIF as well if you turn it on, then gives that copy to visitors whose browser can read it. The file that was uploaded stays where it is, so every link to it keeps working and taking the plugin off leaves the site as it was.

It needs WordPress 6.0 and PHP 8.1 or later.

## Which setup you need

- **The site is on our hosting.** There is nothing to set up. The account's [Image Optimizer page](https://reggiodigital.com/images) lists each site and installs the plugin with one click. Images are converted on the server the site runs on, the server hands out the smaller copy before WordPress is even reached, and no key is needed. That page says which sites are included.
- **The site is hosted anywhere else.** Install the plugin yourself and connect it with the account's key. The images are converted on our servers and written back to the site.

## Installing it yourself

1. Download the plugin from `https://reggiodigital.com/plugins/reggio-image-optimizer/download`. The same link is on the Image Optimizer page.
2. In WordPress, go to **Plugins, Add New Plugin, Upload Plugin**, choose the zip and activate it.
3. Copy the key from the [Image Optimizer page](https://reggiodigital.com/images). The key appears once image optimization has been added to the account, which a site we do not host needs.
4. In WordPress, go to **Media, Image Optimizer**, paste the key into **Reggio key** at the bottom and save.
5. Press **Optimize everything** at the top of the same screen to work through the images already in the library. New uploads are converted as they arrive.

Updates come from us and appear in WordPress's own updates screen like any other plugin.

### One key, several sites

One key covers every site on the account that is not on our hosting, up to 10. A site joins the list the first time it sends us an image, and the Image Optimizer page shows the list. When it is full, the next site shows an error saying so: remove a site you no longer use from that page to make room. Removing a site never takes away images it already converted.

If a key leaks, replace it on the Image Optimizer page. The old key stops working straight away, so paste the new one into every site that uses it.

## What it converts

Everything is on the **Media, Image Optimizer** screen.

| Setting | Default | Notes |
| --- | --- | --- |
| Photographs (JPEG) | On | |
| Graphics (PNG) | Off | Converting can soften the hard edges in logos and screenshots. Turn it on if the PNGs are photographs. |
| Animations and graphics (GIF) | Off | A moving GIF is always left exactly as it is. |
| AVIF | Off | Adds a second, smaller copy for browsers that support it. |
| New uploads | On | Converts images as they are uploaded. |
| Quality | 82 | Looks the same as the original to the eye. Higher keeps more detail and saves less. |
| Sizes to skip | None | Leave particular WordPress image sizes alone. |

A single image can be up to 32MB.

Conversion runs in the background on WordPress's scheduler, which only runs when someone visits the site. On a quiet site with a big library, the progress on the settings screen can stall. Visiting the site moves it on, and so does the command line below.

## Where the files go

Each copy sits beside its original with the new extension added to the end: `photo.jpg` gets `photo.jpg.webp`, and `photo.jpg.avif` when AVIF is on. That is the same naming Imagify uses, so a site moving from Imagify keeps the copies it already has and the plugin picks them up as they are.

The media library gets an **Optimized** column showing what was saved for each image, with an **Undo** link that deletes that image's copies.

## How visitors get the smaller image

The **Delivery** setting decides it.

- **Decide for me**, the default, rewrites the page unless the server already serves the smaller copy itself, which is how sites on our hosting work.
- **In the page** wraps each image in a `picture` element offering the smaller copies, with the original as the fallback. A browser that cannot read WebP or AVIF quietly takes the original. An image is only wrapped when every size in its `srcset` has a copy, so a half-converted image is never shown broken.
- **My server already handles it** leaves the page alone. Choose it only if the web server swaps `photo.jpg` for `photo.jpg.webp` on its own.

Some images never appear in an `img` tag: a WooCommerce gallery zoom, a lazy loader or a slider keeps the real address in an attribute and swaps it in with a script. The plugin also rewrites these attributes when a copy exists: `data-large_image`, `data-thumb`, `data-src`, `data-lazy-src`, `data-lazy`, `data-original`, `data-full` and `data-large`. Only WebP is used there, because nothing falls back to the original if a browser cannot read the file. A theme that uses a different attribute can add it:

```php
add_filter('reggio_img_url_attributes', fn (array $attributes) => [...$attributes, 'data-hero']);
```

To keep the plugin away from one image entirely, add `data-reggio-skip` to its tag:

```html
<img src="/wp-content/uploads/2026/09/logo.png" alt="Logo" data-reggio-skip>
```

## From the command line

With WP-CLI on the server:

```bash
wp reggio-images bulk --now
wp reggio-images status
wp reggio-images stats --format=json
wp reggio-images optimize 123 --force
wp reggio-images restore 123
wp reggio-images reclaim --dry-run
```

`bulk` queues the whole library, and `--now` works through it straight away instead of waiting for visitors. `stats` reports what the library has saved. `optimize` converts one attachment by its id, and `--force` rewrites copies that already exist. `restore` deletes one attachment's copies. `reclaim` is described next.

## Freeing up disk space

Off by default, and the one thing here that cannot be undone. With **Delete the original once we have made the smaller copy** turned on, the plugin deletes originals it has already replaced, which on a photo-heavy site is most of the uploads folder. Visitors see no difference and every old address keeps working, because the plugin answers a request for the deleted file with its copy.

It only removes an original when all of these are true:

- Every size of that image has a copy that opens as a real WebP image and is no older than the original.
- A full-size backup of the image exists in `wp-content/uploads/backup`, in the layout Imagify writes. An image with no backup is left alone.

What you give up: the image can no longer be cropped or edited in WordPress, its Undo link goes away, and removing the plugin leaves only the smaller copies. Run `wp reggio-images reclaim --dry-run` first to see how much it would free.

## Taking it off

Deactivating the plugin stops the page rewriting straight away. Deleting it leaves the converted copies on disk, harmless and unused. If originals were never freed up, the site underneath is exactly as it was before.
