=== Imgzen Media Converter - WebP for CDN ===
Contributors: tKubota
Tags: webp, image optimization, cdn, cloudfront, image conversion
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Permanently converts images to WebP at upload time. No conditional serving — works reliably behind CloudFront and any CDN without extra configuration.

== Description ==

**Most WebP plugins break behind a CDN.**

Plugins that serve WebP conditionally (based on browser support) rely on the HTTP `Accept` header to decide which format to deliver. CDNs like CloudFront cache responses aggressively — and unless explicitly configured to vary the cache by `Accept` header, the CDN will serve the same cached format to every visitor, regardless of their browser.

The result: your images stay as JPEG even though WebP conversion is enabled.

**Imgzen Media Converter solves this differently.**

Instead of conditional serving, it permanently replaces the uploaded image with a WebP version at upload time. The attachment itself becomes WebP — WordPress, your CDN, and your visitors all see one format with no negotiation required.

That means zero-configuration CDN compatibility. There is no need to touch
CloudFront cache policies, server rewrite rules, or `.htaccess` delivery logic.
Install it, enable it, and new uploads are handled automatically.

This makes it the right choice when:

* Your site runs behind CloudFront, Fastly, or any CDN with aggressive caching
* You manage sites for non-technical clients who upload images without optimization
* You want uploads handled automatically with no per-image manual steps

== Features ==

* Permanent WebP Conversion
  Replaces uploaded JPEG/PNG with WebP at upload time. No dual-format serving.

* CDN Compatible
  Works behind CloudFront and any CDN without cache policy changes,
  rewrite rules, or special server configuration.

* Optional Physical Cleanup
  Removes original JPEG/PNG files and intermediate sizes from the server
  after successful WebP conversion (can be disabled).

* Safety Guard
  Skips conversion when the WebP output would be larger than the original,
  and guards against images that are still oversized (over 15MB or 6000px)
  after WordPress's standard upload scaling.

* Suppress Intermediate Size Generation
  Choose which intermediate sizes WordPress generates at upload time.

* Storage Saving Statistics
  Displays the total amount of disk space saved through cleanup,
  so you can see exactly how many megabytes have been reclaimed.

* Flexible Quality Control
  Adjustable quality settings for JPEG and PNG,
  including optional PNG lossless conversion and EXIF stripping.

* Dual Engine Support
  Supports both Imagick (recommended) and GD libraries,
  automatically selecting the available engine.

== Why not other WebP plugins? ==

Most WebP plugins use browser detection to serve WebP or the original image
conditionally. This approach breaks with CDN caching (CloudFront, Fastly, etc.)
unless the CDN is configured to vary its cache by the Accept header — a setting
most users are not aware of or cannot easily configure.

The result: the CDN caches whichever format was requested first, and all
subsequent visitors receive that version regardless of their browser's WebP
support.

Imgzen Media Converter takes a different approach: images are permanently converted
to WebP at upload time. The attachment itself becomes WebP — no conditional
serving, no browser detection, no CDN configuration needed. It just works.

For teams and client sites, this also reduces operational friction. There are no
CloudFront policies to explain, no server rules to maintain, and no image workflow
for editors to remember.

== Installation ==

1. Upload the `imgzen-media-cleaner` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the "Plugins" menu in WordPress.
3. Configure the plugin from "Settings" > "Imgzen Media Converter".

== Frequently Asked Questions ==

= Is this only useful behind a CDN? =
No. Even without a CDN, it ensures uploaded images are always WebP without
requiring clients or editors to optimize images before uploading.

= Should I back up my site before using this plugin? =
Yes. Before using Imgzen on a production site, make sure you have a recent
backup of your files and database. Depending on your settings, image conversion
and cleanup features may modify or remove image files.

= Is image deletion permanent? =
Yes. When original image deletion is enabled,
JPEG/PNG files and their intermediate sizes are physically removed
from the server.

This operation is irreversible.
Please ensure you have backups before enabling this option.

= Why permanent conversion? =
Permanent conversion avoids the complexity and storage overhead of keeping two
parallel image formats for every upload. WordPress stores one attachment, the CDN
caches one file, and the server no longer needs to keep unnecessary JPEG/PNG
copies once WebP has been generated successfully.

Modern browsers broadly support WebP, so for many production sites there is
little practical benefit in retaining duplicate originals after conversion.
The result is simpler delivery, smaller storage usage, and fewer moving parts.

= Can I see how much storage I saved? =
Yes. The dashboard shows the total amount of server storage reclaimed through
image optimization and cleanup, making it easy to see the value of the plugin
over time.

= Which images are skipped? =
The plugin skips conversion in the following cases to prevent
performance issues or quality degradation:

1. When the converted WebP file is larger than the original
2. Files still larger than 15MB after WordPress's standard upload processing
3. Extremely large dimensions (over 6000px)

Note: WordPress itself scales uploads larger than 2560px down to a
"-scaled" copy, and the plugin converts that scaled image. The size and
dimension guards are a second line of defense — in practice they mainly
apply when the big image threshold has been disabled or customized.

= Does this plugin convert existing images? =
No. Imgzen Media Converter only processes images at upload time.
It does not perform bulk or retroactive conversions.

= Which PHP extensions are required? =
Imagick with WebP support is recommended.
If unavailable, the plugin falls back to the standard GD library.

== Screenshots ==

1. Dashboard
   Overview of storage savings and current status.

2. Statistics Panel
   Displays total disk space saved through cleanup.

3. Settings
   Control over quality, deletion behavior, and safety guards.

== Changelog ==

= 0.1.0 =
* Initial release
* Automatic WebP conversion on upload
* Optional original image and intermediate size cleanup
* Storage saving statistics
