=== ImOptimizer - Optimize Images ===
Contributors: babapinnak
Tags: webp, images, optimization, compression, imoptimizer
Requires at least: 5.2
Tested up to: 6.9
Stable tag: 1.0
Requires PHP: 7.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Boost site speed by automatically converting uploads to WebP. Features smart memory protection, detailed logging, and zero API dependencies.

== Description ==

**ImOptimizer - Optimize Images** is a safe, lightweight way to serve next-gen images on WordPress by converting uploads to WebP.

Most optimization plugins either rely on external APIs or risk server crashes by processing images without checking memory limits. **ImOptimizer runs fully on your server** using the native PHP GD library and includes a **Smart Memory Guard** that estimates RAM usage before converting—helping prevent memory exhaustion.

### 🚀 Why ImOptimizer?

* **Boost Core Web Vitals:** WebP images reduce page weight and speed up loading.
* **Zero API Fees:** No subscriptions, no credits, no data sharing. Runs locally.
* **Server Safety First:** Skips risky conversions on low memory and detects conflicts (Smush/EWWW/ShortPixel, etc.).
* **Set & Forget:** Auto-converts JPG/JPEG/PNG at upload time.

### ⚡ Feature Highlights

* **Smart Conversion:** Converts the main image AND generated thumbnails (Media Library, WooCommerce, etc.).
* **Self-Cleaning Logs:** Optional logging with retention cleanup (Cron).
* **MIME Sync:** Updates WordPress metadata so `.webp` is recognized correctly.
* **Privacy Focused:** Your images never leave your server.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/bp-imoptimizer-optimize-images/`.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to **Settings > ImOptimizer**.
4. Save your preferences. (Default: Quality 85, Logging Disabled).

== Frequently Asked Questions ==

= Does this convert my existing media library? =
No. The plugin processes **new uploads only**.

= What image formats does this plugin convert? =
It supports **JPG, JPEG, and PNG** images (converted to WebP).

= Can I delete the original images after conversion? =
Yes. Enable **Delete Original Image** in settings.

= Will this work if I don't have an API key? =
Yes. No APIs are used. The plugin relies on your server’s GD library.

= What happens if the uploaded file is too large? =
Images larger than **15MB** are skipped for stability (and logged if logging is enabled).

= Where are the conversion logs saved? =
Logs are stored in a secure folder:
`/wp-content/uploads/bp-imoptimizer-logs/`
In Multisite, logs are stored per site:
`/wp-content/uploads/bp-imoptimizer-logs-{blog_id}/`

= What happens if I uninstall the plugin? =
Your existing WebP images remain on disk and continue to work. The plugin settings/transients and log folders are removed on uninstall.

= Does this work on WordPress Multisite? =
Yes. Each site gets its own isolated log folder.

= Why are my images not converting? =
1. Ensure GD supports WebP (`imagewebp` must exist).
2. Enable logging and review logs.
3. Disable conflicting optimizer plugins (Smush/EWWW/ShortPixel/Imagify, etc.).
4. Check memory limits (the plugin skips conversions if estimated usage is too high).

= Can I rename the plugin folder? =
**No.** Keep the folder name as:
`bp-imoptimizer-optimize-images`
This helps ensure updates, references, and translations remain consistent.

== Changelog ==

= 1.0 =
* Initial release.
* Smart Memory Guard to prevent memory crashes.
* Optional logging + scheduled log cleanup.
* Conflict detection for popular optimizer plugins.
* Secure log directory with access protection and traversal safety checks.
