Imagify
Imagify compresses images after upload and can create WebP or AVIF versions. This page explains when compressed files reach your bucket, which Imagify settings to use and what to check when results look wrong.
How Imagify and WP Media Cloud work together#

- WordPress saves the upload and WP Media Cloud sends the files to your bucket straight away.
- Imagify optimizes the files on your server.
- When Imagify fires its
imagify_after_reoptimize_mediaaction, WP Media Cloud replaces its record and uploads every size again. The optimized files replace the originals in the bucket.
If Imagify finishes after the first upload, the uncompressed file is live on your CDN for a short time. This is listed under Known Behaviors on the About page in WP Media Cloud.
WP Media Cloud shows Imagify on the Integrations page, under Image Optimization.
Under the hood#
- New uploads are offloaded on the
wp_update_attachment_metadatafilter at priority 110. Uploads from the block editor are offloaded as soon as the attachment is created, so the editor gets a CDN URL. - The second upload reads the files from your server. It only runs when Offload on upload is on.
- WP Media Cloud uploads the main file, each generated size and WordPress’s original image. It does not upload Imagify’s WebP or AVIF copies or its backups.
After setting things up, check one new upload. Compare the file size of the CDN copy with the size Imagify reports. If the CDN copy is still the larger original, use Upload optimized files again on this page.
Recommended settings#
In WP Media Cloud (Media Cloud > Settings > Offload Behaviour):
| Setting | Recommendation |
|---|---|
| Offload on upload | On. It also controls the second upload after Imagify finishes. |
| Remove local files | Off. Imagify optimizes the files on your server, and the second upload reads them from there. |
In Imagify (names from Imagify’s recommended settings):
| Setting | Recommendation |
|---|---|
| Auto-Optimize Images on Upload | On. |
| Backup Original Images | On, as Imagify recommends. Backups stay on your server. |
| Resize Larger Images | On, with the largest width your theme displays. |
| Next-Gen Image Creation & Display | Off, unless you have tested it. See the next section. |
WebP and AVIF#
Imagify saves WebP or AVIF copies next to your images on the server. WP Media Cloud does not upload those copies to your bucket.
Imagify offers two display methods:
- Use Rewrite Rules works through your web server. Images served from your CDN never reach your server, and Imagify’s docs note this method does not apply when a CDN is used.
- Use
<picture>Tags only adds a WebP or AVIF source when it finds the file on your server for the image URL. Once WP Media Cloud has rewritten an image to a CDN URL, expect the original JPEG or PNG to be served.
To serve modern formats from the CDN, use a CDN that converts images, such as EWWW Easy IO.
Existing images#
Compress your library with Imagify’s bulk optimization while the files are still on your server. Then offload it with the Bulk Migration Tool. For a library that is already offloaded, follow the steps below.
Upload optimized files again#
WP Media Cloud only uploads a file a second time when an optimizer it listens to reports that it finished. Otherwise the copy in your bucket stays as it was first uploaded.
These steps send the optimized versions of files that are already offloaded. They use WP-CLI.
- In Media Cloud > Settings > Offload Behaviour, switch off Remove local files.
- Bring the files back to the server with Restore to Server on the Dashboard, or run
wp wpmc restore. - Run the optimizer’s bulk optimization and wait until it finishes.
- Run
wp wpmc clear-records. It forgets which files were offloaded on this site. It does not delete anything from your bucket. - If you want the server copies removed again, switch Remove local files back on now.
- Run
wp wpmc offload. Every attachment is uploaded again and replaces the old copy at the same path. - Purge the cache in your CDN, so visitors stop getting the old copies.
Between steps 4 and 6, some images are served from your server instead of the CDN. On multisite, run the commands once per subsite by adding --url=<subsite URL>.
Troubleshooting#
| What you see | What it means | How to fix it |
|---|---|---|
| The Media Library shows the original file size after upload | Imagify has not finished yet. | Reload the Media Library after a minute. |
| The CDN copy is still the uncompressed original | The second upload did not happen, or the CDN cached the old file. | Purge the file in your CDN first. If the bucket copy is still large, follow Upload optimized files again on this page. |
| Imagify cannot optimize offloaded images | The files are no longer on your server. | Switch off Remove local files and use Restore to Server before optimizing. |
| WebP or AVIF images are not served | WP Media Cloud does not upload Imagify’s next-gen copies, and the CDN URL has no local file to match. | Expected. Use a CDN that converts formats, such as EWWW Easy IO. |
| The bucket keeps the uncompressed version, and the image has an offload error | The second upload failed, often because the files were not on the server. WP Media Cloud 1.1.9 or newer keeps the previous cloud record, so the image keeps loading from the cloud. | Follow Upload optimized files again on this page. |