=== DM WebP Optimizer ===
Contributors: dmahasan
Tags: webp, image optimization, image compression, media library, AI images
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Automatically convert PNG and JPEG images to WebP with proper sizing — for every image on your site, including AI-generated images, with nothing deleted unless you choose to.

== Description ==

**DM WebP Optimizer** converts your images to the modern WebP format so your site loads faster, without changing your workflow. It works the same way no matter where an image comes from — uploaded through the Media Library, dropped in by a page builder, or generated by an AI image tool — because it hooks directly into WordPress's own image-processing pipeline instead of any single upload source.

= How it works =

1. **New uploads** — every PNG/JPEG uploaded from now on is automatically converted to WebP at the correct size and quality, with no extra steps.
2. **Existing images** — a one-click bulk converter processes your existing Media Library in the background, creating a WebP version alongside every original (originals are never touched at this stage).
3. **Auto-replace (optional)** — once you're happy with the results, "finalize" permanently switches your database over to WebP and rewrites every reference across your posts, pages, and page-builder data (including PHP-serialized and JSON-shaped fields), so the WebP files become the site's real images.

Nothing is deleted at any point unless you explicitly enable "Delete originals on finalize" — by default, your original PNG/JPEG files always remain on disk as a safe fallback.

= Features at a glance =

* Automatic WebP conversion for new uploads, from any source
* Configurable quality and maximum width (so full-size originals are capped to a sensible size)
* One-click bulk conversion of your existing Media Library with a live progress bar
* Safe, reversible "serve WebP" mode that doesn't touch your database
* Optional one-click "auto-replace" that permanently switches the database over to WebP
* Serialized-data-safe and JSON-safe find-and-replace across post content and postmeta

== Installation ==

1. Upload the `dm-webp-optimizer` folder to `/wp-content/plugins/`, or install the zip directly via Plugins → Add New → Upload Plugin.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to Settings → DM WebP Optimizer to review quality/size settings and run the bulk converter on your existing images.

== Frequently Asked Questions ==

= Will this delete my original images? =

No, not by default. Original PNG/JPEG files are kept on disk as a fallback. Only if you explicitly enable "Delete originals on finalize" will they be removed, and only after a WebP replacement has been fully verified.

= Does this work with images generated by AI tools? =

Yes. The plugin hooks into WordPress's core image-processing filters (`image_editor_output_format`, `wp_editor_set_quality`, `big_image_size_threshold`), which apply to every image regardless of how it entered the Media Library.

= What's the difference between "serve WebP" and "finalize"? =

"Serve WebP" swaps the image URL at render time without touching your database — fully reversible by turning the setting off. "Finalize" permanently rewrites the database (attachment metadata and every reference across your content) so the WebP file becomes the image's real, permanent version.

= Will this break my page builder layouts? =

The finalize step's find-and-replace is serialized-data-safe and JSON-safe, so it correctly updates Elementor/Gutenberg-style postmeta without corrupting it. As with any bulk database change, take a backup first.

== Changelog ==

= 1.0.1 =
* Updated "Tested up to" to WordPress 7.0.
* Minor readme and plugin metadata cleanup.

= 1.0.0 =
* Initial public release: automatic conversion for new uploads, bulk converter for existing images, optional auto-replace/finalize, and WebP serving.

== Upgrade Notice ==

= 1.0.1 =
* Updated "Tested up to" to WordPress 7.0.
* Minor readme and plugin metadata cleanup.

= 1.0.0 =
First public release.
