=== HostSalt Image Optimizer ===
Contributors: boldandigital
Tags: image optimization, compress images, webp, avif, media library
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Automatically optimize, compress and convert images to WebP or AVIF on upload — powered by the HostSalt IO API.

== Description ==

HostSalt Image Optimizer connects your WordPress site to the HostSalt IO cloud API to automatically compress and convert images on upload. No server-side libraries required — just install, connect and start saving bandwidth.

**Features:**

* Automatic optimization on upload — no manual steps needed
* Converts images to WebP or AVIF for maximum compression
* Smart format selection — picks whichever format saves more
* Lossless backup — restore originals any time with one click
* Bulk optimize your entire existing media library
* Bulk restore all images to their originals
* Monthly usage dashboard built into wp-admin
* Works with all themes and page builders
* Multisite compatible

**How it works:**

When you upload an image, HostSalt Image Optimizer sends it securely to the HostSalt IO API. The API compresses and converts the image, then returns the optimized version. The original is kept as a backup so you can restore at any time.

A free plan is available with 50 optimizations per month. Paid plans are available for higher volumes.

== External Services ==

This plugin sends image data to an external API service operated by HostSalt:

* **API endpoints:** https://images.hostsalt.com/optimize and https://images.hostsalt.com/usage/{site_id}
* **Data sent:** image file contents, output format preference, quality setting, max width setting, and a unique site identifier derived from your site URL (MD5 hash)
* **Data received:** optimized image file
* **When:** on image upload (automatic), on manual Optimize button click, and during bulk optimization

This service is operated by HostSalt. Please review the following before use:

* Terms of Service: https://hostsalt.com/terms-of-service/
* Privacy Policy: https://hostsalt.com/privacy-policy/

No personal user data is transmitted. Only image files and site configuration are sent.

== Installation ==

1. Upload the `hostsalt-io` folder to the `/wp-content/plugins/` directory, or install via the WordPress plugin installer.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Go to **HostSalt IO** in the WordPress admin sidebar to configure settings and view usage.
4. Upload images — they are optimized automatically.

== Frequently Asked Questions ==

= Do I need to install anything on my server? =
No. All processing is handled by the HostSalt IO cloud API. The plugin requires outbound HTTPS connections to images.hostsalt.com.

= Are my original images kept? =
Yes. A backup of every original image is saved before optimization. You can restore any image individually or restore all images in bulk from the settings page.

= What image formats are supported? =
JPEG, PNG, GIF and WebP images are supported as input. Output can be WebP, AVIF, or the same format as the original.

= What happens if I reach my monthly limit? =
Optimization stops and a notice is shown in wp-admin. Your existing images are unaffected. You can upgrade your plan or wait for the next billing cycle.

= Does this work with Multisite? =
Yes. Each site in a multisite network is treated independently with its own usage quota.

= Will this slow down my site? =
No. Optimization runs after the admin page response is sent (via shutdown hook) or via WP-Cron. It is invisible to your site visitors.

= What happens when I delete the plugin? =
All plugin data is removed on uninstall — settings, post meta, cron jobs and transients. Optimized image files on disk are kept (they are your media files).

== Screenshots ==

1. Media library column showing optimization status
2. Settings page with usage meter and bulk actions
3. Format, quality and max-width configuration options

== Changelog ==

= 1.0.3 =
* Renamed: internal identifier `hostimop` changed to `hsio` throughout the plugin
* Drop-in replacement for HostImop plugin with no data loss on upgrade

= 1.0.2 =
* Fixed: backup files now stored in a plugin-specific uploads directory instead of beside the original media file
* Fixed: `set_time_limit` now scoped to actual optimization tasks instead of running on every admin request
* Fixed: settings form field name mismatch that caused format preference not to save
* Fixed: hardcoded upgrade URL replaced with dynamic value from plugin settings
* Fixed: error suppression removed from file restore operations to surface failures properly
* Improved: removed unused activation code and internal developer comments
* Improved: code indentation and structure consistency

= 1.0.0 =
* Initial release
* Automatic optimization on upload via shutdown hook + WP-Cron backup
* WebP and AVIF conversion with smart format selection
* One-click restore of original images
* Bulk optimize and bulk restore
* Monthly usage dashboard
* Multisite support

== Upgrade Notice ==

= 1.0.0 =
Initial release.
