=== OptiFusion – Image Converter & Optimizer ===
Contributors: deshraahi
Tags: image optimization, webp, avif, compress images, media library
Requires at least: 5.6
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.3.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Bulk convert images to WebP/AVIF, compress without visible quality loss, auto-optimize on upload, and see exactly how much space you saved.

== Description ==

OptiFusion optimizes your entire WordPress Media Library:

* Bulk convert PNG/JPG images to WebP or AVIF
* Smart lossy/near-lossless compression (adjustable quality)
* Auto-optimize every image the moment it's uploaded
* Automatic backup of original images with one-click restore
* Strip EXIF/metadata for extra savings
* Optional max-width resize for oversized images
* WebP fallback via <picture> tags — modern browsers get WebP,
  old browsers (e.g. IE11) automatically get the original image
* Lazy loading — native `loading="lazy"` or an advanced
  IntersectionObserver-based JS loader with automatic fallback
  for very old browsers
* CDN integration — serve all images (and their srcset/thumbnails)
  from your own CDN by simply entering its URL
* Unused Images finder — scan your entire library for images not
  referenced anywhere on the site, select them, and bulk delete
* Dashboard shows total images, space saved, and average savings
* Works via WordPress' native `wp_generate_attachment_metadata` hook,
  so it's compatible with page builders, importers, and the REST API
* No conflicting global functions/classes — everything is prefixed
  `OptiFusion_` / `optifusion_`

Works with either the Imagick PHP extension (recommended, supports AVIF)
or the GD library (fallback, WebP only on most setups).

== Installation ==

1. Upload the `optifusion` folder to `/wp-content/plugins/`
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Go to OptiFusion → Settings to configure format/quality
4. Go to OptiFusion → Bulk Optimize to process your existing library

== Frequently Asked Questions ==

= Will this break existing image URLs on my site? =
When an image is converted to a new format, OptiFusion updates the
WordPress attachment record and regenerates thumbnail sizes, so URLs
used through WordPress functions stay correct. Hard-coded URLs in
custom code that reference the old file extension would need updating.

= Can I undo the optimization? =
Yes — enable "Backup Original Images" in Settings (on by default) and
use the Backup & Restore page to revert any image, or all images at once.

== External services ==

This plugin's optional **AI Tools** feature (alt-text and tag generation
for an image) connects to the **Google Gemini API**
(generativelanguage.googleapis.com).

* This is only used if you enter your own Google Gemini API key on the
  AI Tools settings page and explicitly click "Generate" on a specific
  image. No data is sent unless you take this action.
* When used, the selected image's file data is sent to Google's servers
  so the Gemini model can analyze it and return a suggested alt text
  and tags.
* This service is provided by Google LLC: [Terms of Service](https://ai.google.dev/gemini-api/terms), [Privacy Policy](https://policies.google.com/privacy).

The plugin's duplicate-image finder and blur detector run entirely
locally on your own server and do not send any data anywhere.

== Changelog ==

= 1.3.0 =
* Added AI Tools page: local duplicate/similar image finder (free, unlimited), local low-quality/blur detector (free, unlimited), and AI-powered alt-text + tag generator using the Google Gemini free tier.

= 1.2.0 =
* Added Unused Images finder — scan the Media Library for images not used anywhere on the site, select them, and bulk delete.
* Converted all admin UI text to plain English.

= 1.1.0 =
* Added WebP fallback mode using <picture> tags for old browser support.
* Added lazy loading (native + advanced JS/IntersectionObserver mode).
* Added CDN integration with URL rewriting.

= 1.0.0 =
* Initial release.
