=== OptiFoto ===
Contributors: guardafoto
Tags: image optimization, webp, compress images, image optimizer, smush
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

OptiFoto by GuardaFoto — free image optimization for WordPress: compress JPEG/PNG uploads and convert them to WebP. Free, unlimited, no credits, no account, no API key.

== Description ==

OptiFoto, a free tool by GuardaFoto, optimizes the images you upload to WordPress so your pages load faster and weigh less. New uploads are optimized automatically, and your existing library can be optimized in bulk, in batches, from **Media > Bulk OptiFoto**.

Other optimizers charge per image or sell monthly credits. OptiFoto does not: optimization is **free and unlimited** under a generous fair-use limit, with **no account, no credits and no API key**.

What it does:

* Converts JPEG and PNG uploads to WebP at your chosen quality (default 82), or simply recompresses them in their original format if you prefer.
* Strips EXIF and other metadata from every optimized image.
* Keeps an optional backup of each original next to it as `<file>.optifoto-bak`.
* Shows the savings per image right in the media library: “OptiFoto: −XX%”.
* Optimizes your existing library in bulk, 10 images at a time, with a live progress log.
* Totals at a glance: the settings page shows how many images you have optimized, their original and optimized sizes and your overall savings so far.
* Changed your mind? Restore any original with one click from the media library — every optimized image with a backup gets a “Restore original” link right next to its savings.

Settings live under **Settings > OptiFoto**: your totals on top, then API URL, quality, mode (WebP or compress only), keep-backups toggle and auto-optimize-on-upload toggle.

The optimization itself runs on the OptiFoto API — see “External service” below for exactly what is sent and when.

== External service ==

This plugin relies on the OptiFoto API, a third-party service by GuardaFoto, operated by A3Q Global:

* Service: OptiFoto by GuardaFoto — https://guardafoto.com
* About the service: https://guardafoto.com
* API endpoint used by this plugin: https://api.guardafoto.com/api/optimize
* Terms of service: https://guardafoto.com/terms/
* Privacy policy: https://guardafoto.com/privacy/

When an image is optimized — automatically on upload, or when you run the bulk tool — the plugin sends **the image file itself**, plus the two settings that control the job (the quality number and the mode, WebP or compress), to the OptiFoto API. The API compresses/converts the image and returns the optimized bytes; the plugin then replaces the file on your server (keeping a backup first, if that setting is on) and stores the before/after byte counts in the attachment's metadata so the savings can be shown in the media library.

The plugin does **not** send WordPress user data, author information, post content, site URLs beyond the API request itself, cookies or administrator details. No request is made when the plugin is merely activated or when a page is viewed: requests happen only when an image is uploaded (with auto-optimize on) or when you start a bulk run.

The plugin's PHP code does not download or execute remote files.

== Installation ==

1. Upload the `optifoto` folder to the `/wp-content/plugins/` directory, or install the ZIP file through **Plugins > Add New > Upload Plugin** in WordPress.
2. Activate **OptiFoto** through the **Plugins** screen.
3. Check **Settings > OptiFoto** — the defaults (WebP, quality 82, backups on, auto-optimize on) work out of the box.
4. Upload an image and look at the OptiFoto column in the media library to see its savings.
5. To optimize images you uploaded before installing OptiFoto, go to **Media > Bulk OptiFoto** and press Start.

No account, API key or configuration is required.

== Frequently Asked Questions ==

= Is OptiFoto really free and unlimited? =

Yes. There are no credits to buy and no paid tier. The API applies a generous per-site fair-use limit (currently 1,000 optimizations per day) only to stop abuse.

= What happens to my original images? =

With the backup setting on (the default), each original is kept next to the optimized file as `<file>.optifoto-bak` before anything is replaced. A file is only ever replaced when the optimized version is smaller. And if you ever want one back, the media library shows a “Restore original” link next to its savings: one click copies the backup back, clears the stored stats and removes the backup.

= Does converting to WebP rename my files? =

In this first version the optimized bytes keep the original file name and path, so nothing in your content breaks and WordPress metadata stays valid; the media library column shows the real savings. A future version will offer true .webp file renaming.

= Which formats are supported? =

JPEG, PNG and WebP uploads. Other formats are left untouched.

= Does OptiFoto work in Spanish? =

Yes. The media column and the bulk tool follow your site language: Spanish on Spanish WordPress locales, English otherwise.

== Screenshots ==

1. The OptiFoto column in the media library, showing the savings per image and the “Restore original” link.
2. Settings > OptiFoto: your totals on top (images optimized, sizes before/after, total savings), then API URL, quality, mode, backups and auto-optimize.
3. Media > Bulk OptiFoto optimizing the library in batches of 10.

== Changelog ==

= 1.0.0 =
* Initial release.
* Automatic optimization of JPEG/PNG/WebP uploads (WebP conversion or same-format compression, quality setting, EXIF stripped).
* Optional per-file backups (`<file>.optifoto-bak`) and savings stored in attachment metadata.
* “OptiFoto: −XX%” savings shown in the media library.
* Bulk optimization of the existing library in batches of 10 via AJAX, under Media > Bulk OptiFoto.
* Settings page under Settings > OptiFoto, with a totals box (images optimized, original vs optimized size, total savings and overall percentage).
* One-click “Restore original” from the media library whenever a backup exists.
* English and Spanish interfaces.

== Upgrade Notice ==

= 1.0.0 =
Initial public release.
