Image Weight Guard

Description

Image Weight Guard helps WordPress users keep their Media Library light and their websites fast. It converts JPG and PNG images to WebP, optimizes them, and stops unnecessarily huge images from being uploaded.

When someone picks an image larger than your size limit (3 MB by default) in the Media Library or the editor’s media modal, a popup appears:

This image is larger than necessary. Recommended: under 500 KB. [Optimize & Upload] [Cancel]

Clicking Optimize & Upload resizes, compresses and converts the image to WebP, removes hidden metadata and cleans the file name, then uploads it to the Media Library.

The plugin can also convert and optimize the images that are already in your Media Library in one click, and it updates the image links in your content automatically.

The plugin works with WordPress image attachments regardless of which page builder or theme you use. It does not require an external service or API.

Features

  • Convert every new JPG, JPEG and PNG upload to WebP automatically.
  • Optimize uploads: resize large images, compress to a target size, remove EXIF and GPS data.
  • Clean file names, for example Homepage Banner FINAL final2.JPG becomes homepage-banner.webp.
  • Stop images over your size limit and offer a one-click “Optimize & Upload” popup.
  • Cancel an oversized image while still uploading your other selected files.
  • Convert and optimize the images already in your Media Library from the settings page.
  • Rebuild thumbnails and update image links in posts, pages, custom fields and settings.
  • Keep a backup copy of the original files when optimizing existing images.
  • Choose the output format: WebP, AVIF or JPEG.
  • Adjust the size limit, target size, maximum width/height and quality.
  • Works in the Media Library and in the editor’s media modal.
  • Does not require an external service or API. Images are processed on your own server.

How It Works

  1. Upload an image in the Media Library or the editor’s media modal.
  2. Images under the size limit are converted to optimized WebP automatically.
  3. If an image is over the limit, a popup asks whether to optimize it.
  4. Click Optimize & Upload to resize, compress and convert the image, or Cancel to skip it.
  5. To clean up images you uploaded earlier, open Settings > Image Weight Guard and click Optimize existing images.

License

This plugin is licensed under the GPL-2.0-or-later license.

Installation

  1. Upload the image-weight-guard folder to the /wp-content/plugins/ directory, or install the plugin from the Plugins screen.
  2. Activate the plugin through the Plugins screen in WordPress.
  3. Open Settings > Image Weight Guard to review the size limit, target size, maximum dimensions, quality and output format.
  4. Upload images as usual. To optimize images that are already in your Media Library, click Optimize existing images on the same settings page.

FAQ

Does this plugin require an external service?

No. Images are converted and optimized on your own server using PHP’s GD or Imagick library. No data is sent to any external service.

What does my server need?

WordPress 6.0 or newer, PHP 7.4 or newer, and GD or Imagick built with WebP support. You can check this under Tools > Site Health > Info > Media Handling. If WebP is not supported, small images are simply uploaded unchanged.

Does it change images I already uploaded?

Not automatically. Go to Settings > Image Weight Guard and click Optimize existing images. Please back up your database and uploads folder first. Original files are kept in wp-content/uploads/imagwegu-originals unless you untick the backup option. Images that would not get smaller are left unchanged.

Does this plugin work with Elementor and other page builders?

Yes. The plugin works with standard WordPress image attachments and is not restricted to a specific page builder. When existing images are converted, image links in posts, pages, custom fields and settings are updated as well, including data that many page builders store there. Please back up your site first and check your key pages afterwards.

Why was my upload rejected?

Images over the size limit must be optimized. Use the Media Library or the editor’s media modal and click Optimize & Upload. Uploaders that cannot show the popup, such as the REST API and the old Media > Add New page, reject large images unless “Optimize without asking” is enabled in the settings.

Can I change the size limit and quality?

Yes. Open Settings > Image Weight Guard to change the size limit, target size, maximum width/height, quality and output format. Developers can also override any setting with the imagwegu_settings filter.

Does it affect videos, PDFs, GIFs or SVGs?

No. Only JPG, JPEG, PNG, AVIF and BMP images are processed. Other file types are left untouched.

Can I undo the conversion of existing images?

If you kept the backup option ticked, the original files are stored in wp-content/uploads/imagwegu-originals. You can copy them back manually. A database backup is recommended before optimizing existing images.

Reviews

Read all 1 review

Contributors & Developers

“Image Weight Guard” is open source software. The following people have contributed to this plugin.

Contributors

Translate “Image Weight Guard” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

1.0.0

  • Initial release.
  • Added automatic WebP conversion and optimization of uploaded images.
  • Added the Optimize & Upload popup for oversized images.
  • Added EXIF removal, resizing, compression and file name cleanup.
  • Added a bulk tool to optimize existing Media Library images.
  • Added a settings page.