Docs

Imagify

4 min readUpdated June 28, 2026

Imagify compresses images and optionally serves WebP and AVIF versions via <picture> elements. WP Media Cloud and Imagify work together without conflict for compression. There is one important limitation if you use local file removal alongside Imagify’s WebP and AVIF display feature.

How they work together#

Imagify fetches image files for compression using the URL returned by WordPress’s wp_get_attachment_url(), which WP Media Cloud filters to return the CDN URL. Imagify then fetches the binary data from that URL, runs it through the Imagify API, and writes the optimized result back. WP Media Cloud re-offloads the optimized file to cloud storage automatically. No additional configuration is needed for compression to work with offloaded files.

WebP and AVIF display with local file removal#

Imagify’s WebP and AVIF display feature works by scanning the page HTML after rendering and wrapping <img> elements with <picture> tags that include WebP and AVIF source alternatives. Before inserting a <source> element, Imagify checks whether the WebP or AVIF variant exists on the local filesystem using a file path check.

If local file removal is enabled in WP Media Cloud and local copies have been deleted, this filesystem check returns false. Imagify falls back to the original <img> tag without a <picture> wrapper, and WebP and AVIF versions are not served even though they exist in cloud storage.

To use Imagify’s WebP and AVIF display feature alongside WP Media Cloud cloud offload, leave local file removal disabled. Local copies remain on the server, Imagify’s filesystem check succeeds, and WebP and AVIF versions are served correctly. The compressed original is still offloaded to and served from cloud storage via CDN.

If disk space is the primary concern and you need local file removal enabled, compressed files are still offloaded and served from CDN in their original format. Only the WebP and AVIF <picture> wrapping feature is affected.

Configuration#

No configuration is required in either plugin to make compression work together. WP Media Cloud detects Imagify automatically and reports its status on the Integrations tab in the plugin dashboard.

Imagify offers synchronous and asynchronous compression modes:

  • Synchronous mode — compression runs during the upload request. The file in cloud storage is the optimized version from the first offload. The media library shows the correct compressed file size immediately after upload.
  • Asynchronous mode — compression runs in the background after the upload completes. WP Media Cloud offloads the original uncompressed file immediately so CDN URLs are available right away in the media library and block editor. The optimized version is re-offloaded once the background job completes. During this window the uncompressed file is live in your bucket.

Bulk optimization after migration#

If you run the WP Media Cloud bulk migration tool to offload your existing media library and then want to compress those files with Imagify, run Imagify’s bulk optimization tool after the migration completes. Imagify will compress each file by fetching it from the CDN URL and WP Media Cloud will re-offload the optimized version to cloud storage automatically.

Troubleshooting#

Imagify is not compressing offloaded files
Imagify fetches files from the CDN URL for compression. If the bucket is private or the CDN hostname is not resolving, Imagify cannot fetch the file and compression will fail. Confirm the file URL is publicly accessible before running bulk optimization.

WebP and AVIF versions are not being served
Local file removal is likely enabled. Imagify checks for the WebP or AVIF file on the local filesystem before inserting a <picture> element. If local files have been deleted, this check fails and Imagify falls back to the original <img> tag. Disable local file removal to restore WebP and AVIF serving.

File size in the media library shows the original uncompressed size
Imagify is running in asynchronous mode. The size shown immediately after upload reflects the original file. Once the background compression job completes, the optimized version is re-offloaded and the size will update when you reload the media library.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only