=== Imgpressor ===
Contributors: imgpressor
Tags: image compression, webp, avif, optimize images, page speed
Requires at least: 5.8
Tested up to: 6.9
Stable tag: 0.1.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Convert your WordPress media library to AVIF and WebP automatically. Shrink image file sizes by up to 80% without visible quality loss.

== Description ==

Imgpressor converts your existing WordPress images to next-generation formats — AVIF first, WebP as fallback, original JPEG/PNG as last resort — using a `<picture>` tag replacement that requires no theme changes.

**How it works:**

1. You enter your free API key in Settings.
2. Select images in the Bulk Compress screen and click Compress.
3. Imgpressor sends each image to the Imgpressor cloud API (`api.imgpressor.in`), which converts it to AVIF and WebP.
4. The converted files are saved back to your server alongside the originals.
5. A `<picture>` tag is injected at render time — browsers that support AVIF get AVIF, others get WebP, and older browsers fall back to the original.

No CDN required. Converted files live on your own server.

**Features:**

* AVIF + WebP conversion in a single credit
* `<picture>` tag replacement — no theme edits required
* Database URL replacement for images used in post content
* Bulk compress UI with list and grid views, sortable columns, file type filter
* Compressed tab showing savings per image
* Queue-based background processing for paid plans (browser can be closed)
* Free plan: 300 credits/month, manual compression, max 10 per batch
* Pro plan: 3,000 credits/month with background queue
* Agency plan: 10,000 credits/month, up to 5 bound domains

**External Service:**

This plugin connects to the Imgpressor API (`https://api.imgpressor.in`) to perform image compression. When you compress an image, the image file and your site URL are sent to this service. A free API key is required.

* Service website: https://imgpressor.in
* Privacy policy: https://imgpressor.in/privacy
* Terms of service: https://imgpressor.in/terms

No image data is stored on Imgpressor servers after conversion. Converted files are returned to and stored on your own WordPress server.

== Installation ==

1. Upload the `imgpressor` folder to `/wp-content/plugins/`, or install via Plugins → Add New → Upload Plugin.
2. Activate the plugin through the Plugins menu.
3. Go to **Imgpressor → Settings** and enter your API key. Get a free key at https://imgpressor.in.
4. Go to **Imgpressor** (the main menu item) to see your media library and start compressing.

== Frequently Asked Questions ==

= Is it free? =

Yes. The free plan includes 300 credits with no time limit — use them at your own pace, no credit card required. One credit converts one image (both AVIF and WebP are generated per credit). Once your free credits are used, upgrade to a Starter Pack or monthly plan at https://imgpressor.in.

= Where are the converted files stored? =

On your own WordPress server, in the same uploads directory as your original images. Imgpressor does not host your images.

= Will it break my existing images? =

No. The original JPEG/PNG files are kept unless you explicitly choose to delete them. The `<picture>` tag replacement means browsers that cannot display AVIF or WebP automatically fall back to the original.

= Does it work with page builders? =

Yes. The database URL replacement updates images in post content, including content created by page builders that stores image URLs in post meta.

= What image formats are supported? =

JPEG and PNG input images are supported. GIF and SVG are not converted.

= Do I need to configure my server? =

No server configuration is required. The plugin uses the WordPress HTTP API to communicate with the Imgpressor cloud service and saves files via standard WordPress file functions.

= What happens if I deactivate the plugin? =

The plugin automatically unbinds your site from the API key on deactivation. Your converted AVIF and WebP files remain on your server. The `<picture>` tag replacement stops, so browsers will load the original JPEG/PNG files again.

== Screenshots ==

1. Bulk Compress screen — list view with compression stats bar
2. Compressed tab showing file size savings per image
3. Settings page — API key field with live credit usage display

== Changelog ==

= 0.1.0 =
* Initial public release
* AVIF + WebP bulk conversion
* `<picture>` tag and database URL replacement
* Free/Pro/Agency plans with rolling 30-day credits
* Domain binding — each API key locked to one site (free/pro) or five sites (agency)
* Background queue processing for paid plans
* Original file deletion with registered and unregistered variant cleanup

== Upgrade Notice ==

= 0.1.0 =
Initial release.
