=== W3ctrl Smart Image Optimizer ===
Contributors: w3ctrl
Tags: images, optimize, webp, avif, compression
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Optimize JPEG, PNG, and WebP locally. Resize, WebP/AVIF, backups, bulk processing, and WP-CLI — no remote API.

== Description ==

W3ctrl Smart Image Optimizer reduces Media Library image size on your WordPress server. Files are not sent to a remote optimization API.

It uses WordPress image editors (Imagick or GD). Originals can be backed up before a file is replaced, and a file is replaced only when the result is smaller.

= Features =

* JPEG and PNG optimization, including optional EXIF/metadata stripping
* WebP copies next to originals, with optional front-end delivery via a `picture` element
* AVIF copies next to originals when the server can encode AVIF, with optional front-end delivery
* Resize oversized originals during optimize, plus a manual resize control on the plugin Media screen
* Convert opaque PNG files to JPEG
* Skip files above a maximum size or below a minimum size
* Exclude JPEG, PNG, WebP, or selected uploads folders
* Automatic optimization when images are uploaded
* Bulk optimization with progress, pause, cancel, and retry failed
* Dry-run savings estimate before a bulk run
* Per-image optimize, restore, and resize
* Original backups; restore one image, restore all, or delete backups
* Dashboard statistics and server capability checks
* WP-Cron scheduled optimization
* Optional LiteSpeed Cache and Cloudflare URL purge after optimize or restore
* Media Library column, row actions, and bulk actions
* WP-CLI and a REST API for optimize, stats, and restore
* Optional removal of plugin stats and backups on uninstall (Media Library files are never deleted)

= Privacy =

Images are processed on your own server. The plugin does not phone home and does not add telemetry.

LiteSpeed cache purge (when enabled) runs only on this server when LiteSpeed Cache is present. It does not send data to a remote LiteSpeed service.

= External services =

This plugin can optionally connect to Cloudflare to purge cached image URLs after an attachment is optimized, restored, or resized.

It sends only the affected media file URLs to `api.cloudflare.com`, and only when an administrator enables Cloudflare purge and saves a Cloudflare Zone ID and API token in Settings. Image files themselves are not uploaded to Cloudflare. The feature is off by default.

This service is provided by Cloudflare, Inc.:
[Terms of Service](https://www.cloudflare.com/terms/)
[Privacy Policy](https://www.cloudflare.com/privacypolicy/)

= WP-CLI =

`wp sio optimize`
`wp sio optimize --limit=100`
`wp sio stats`
`wp sio restore <attachment_id>`

= Developers =

Filters and actions include `w3ctrl_sio_booted`, `w3ctrl_sio_after_optimize`, `w3ctrl_sio_after_restore`, `w3ctrl_sio_after_resize`, and `w3ctrl_sio_supported_mime_types`.

The admin menu parent slug is `w3ctrl`. Other W3ctrl plugins can add a submenu under that slug and register themselves on the `w3ctrl_admin_plugins` filter.

== Installation ==

1. Upload the `w3ctrl-smart-image-optimizer` folder to `/wp-content/plugins/`.
2. Activate the plugin through the Plugins screen.
3. Open **W3ctrl → Image Optimizer** to review statistics and server capabilities.
4. Use the in-plugin **Media** and **Settings** links to manage images and options.
5. Use **Optimize remaining images** or Media Library actions for existing files.

== Frequently Asked Questions ==

= Does this plugin upload my images to a third party? =

No. Optimization happens on the WordPress server. Optional Cloudflare purge (off by default) only sends image URLs when you enable it and save your own Cloudflare credentials.

= Will original images be overwritten? =

When backups are enabled, a copy is stored before a file is changed. A file is replaced only when the optimized version is smaller.

= What happens if an image cannot be optimized? =

That image is marked as failed or skipped. Bulk optimization continues with the rest of the queue.

= Can I restore an image? =

Yes, if original backups are enabled. Use Restore on the plugin Media screen, in the Media Library, or `wp sio restore <id>`.

= Does it work with Elementor and WooCommerce? =

Yes. The plugin does not require either one. It optimizes Media Library attachments that those plugins use, and WebP/AVIF delivery wraps standard WordPress image tags.

= What is removed when I uninstall the plugin? =

Settings and cron events are always removed. Statistics and backup files are removed only if you enable **Delete data on uninstall**. Media Library images are never deleted.

== Screenshots ==

1. Dashboard statistics and bulk optimization.
2. Settings for quality, formats, rules, and scheduling.

== Changelog ==

= 1.0.3 =
* Align text domain with the approved directory slug `w3ctrl-smart-image-optimizer`.

= 1.0.2 =
* Prefix dashboard template variables for Plugin Check compliance.
* Add missing translators comment for resize size string.

= 1.0.1 =
* Document Cloudflare as an optional external service with Terms and Privacy links.
* Use site_url for the WP-Cron example URL.
* Rely on WordPress.org language packs instead of load_plugin_textdomain().

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.3 =
Text domain matches the WordPress.org plugin slug.

= 1.0.2 =
Plugin Check compliance fixes.

= 1.0.1 =
Clarifies optional Cloudflare cache purge documentation for directory review.

= 1.0.0 =
Initial release of W3ctrl Smart Image Optimizer.
