=== DZIEWA Media Converter — AVIF + WebP ===
Contributors: putiek
Tags: images, avif, webp, optimization, performance
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 8.3
Stable tag: 1.5.23
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Converts JPEG/PNG to AVIF and WebP; rewrites content to &lt;picture&gt; with JPG/PNG fallback. Completely free, no paid version.

== Description ==

DZIEWA Media Converter creates sidecar `.avif` and `.webp` files next to your originals (no replacement of JPG/PNG in the Media Library). On the front end it can rewrite `<img>` tags to `<picture>` so browsers pick AVIF/WebP when available. The plugin is **entirely free to use** — no license fees, no pro version, and no paid add-ons.

= How it works =

The plugin generates additional AVIF and/or WebP files beside every JPEG/PNG you upload. Originals are never touched or replaced — they remain in the Media Library and on disk as a safe fallback. The optional content filter detects `<img>` tags in your post content and wraps them in `<picture>` so modern browsers download the smaller AVIF/WebP version, while older browsers transparently fall back to JPG/PNG.

= Conversion =

* **AVIF + WebP, AVIF-only or WebP-only** output modes. AVIF requires PHP GD built with AVIF support; the plugin auto-detects this on activation and gracefully falls back to WebP-only when AVIF is unavailable.
* **Configurable quality** per format (independent AVIF and WebP quality sliders in settings).
* **Automatic conversion on upload** — new attachments are converted in the background via WP-Cron or Action Scheduler (when available), so the upload screen never blocks.
* **Intermediate sizes (thumbnails)** are optionally converted too, so every srcset variant has its own AVIF/WebP sidecar.

= Existing media =

* **Background queue** processes already-uploaded images in configurable batches (default 20 files per run, range 5–200). You can scope the queue to a single uploads subfolder and/or a date range to avoid scanning the whole library at once.
* **Bulk action in the Media Library** — select images and run **Convert to AVIF/WebP** from the bulk menu.
* **Per-attachment button** — Media Library list, attachment edit screen and media modal each show a **Convert to AVIF/WebP** button next to live savings stats (before/after size, percentage saved per format).

= Front end (content rewriting) =

* Optional `<picture>` rewrite in `the_content` and post thumbnails — browsers automatically pick the lightest format they support.
* Lookup of attachment IDs from URLs is cached in the WordPress object cache (Redis/Memcached when available) and memoised per request, so heavy pages with many images stay fast.

= Tools & admin UI =

* **Cleanup tool** — remove old generated `.avif` / `.webp` sidecars by age (30/60/90/120 days) and folder scope, with a per-folder picker.
* **Admin bar download** — optional link on singular posts/pages to download the original JPG/PNG of the featured image (useful for social platforms that don't accept AVIF/WebP).
* **Event log** — last 100 events (errors, conversions, queue runs) visible on the settings page.
* **Three-option uninstall dialog** — when removing the plugin you choose between *Cancel*, *Remove (keep generated files)* or *Remove and delete files*.

= Privacy & dependencies =

* No external services, no remote calls, no tracking. Everything runs on your own server.
* Requires PHP 8.3+ and PHP GD with WebP support (`imagewebp`). AVIF is optional.
* Fully translated to Polish; English source strings ready for further translations via GlotPress.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install through the Plugins screen.
2. Activate the plugin. PHP must support WebP in GD (`imagewebp`); AVIF is optional and auto-detected.
3. Configure settings under **Settings → DZIEWA Media Converter** in the admin menu, or use the **Settings** link in the Plugins screen.

== Frequently Asked Questions ==

= Does this replace my JPG/PNG files? =

No. Original files stay in place; AVIF/WebP are additional files beside them.

= What if my host has no AVIF in GD? =

The plugin falls back to WebP-only modes and explains this on the settings page.

== Changelog ==

= 1.5.23 =
* **New:** *Uninstall behavior* option in settings — opt-in checkbox to delete all generated `.avif` / `.webp` files when removing the plugin. Default is to keep the files (safe for reinstall).

= 1.5.22 =
* **Frontend admin bar (optional):** new setting to show a **Download original featured image** link on singular posts/pages (when a featured image exists). Serves the original JPG/PNG from disk with a forced download, useful for social platforms that expect a non–AVIF/WebP master file. Requires a user who can edit the post; uses a nonce on the download URL.
