=== Bender - Mosaic Image Protection ===
Contributors: opencluster
Tags: image protection, watermark, copyright, anti-scraping, iptc
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.1.7
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Protect your images from scrapers, hotlinking, and theft with mosaic tiling, watermarking, and IPTC copyright metadata — without hurting SEO or speed.

== Description ==

Your WordPress images travel as a mosaic. Whoever steals them finds only shuffled tiles.

Bender protects your site's photos from scrapers, AI training bots, and outright theft, without touching SEO, speed, or the experience of your human visitors.

= How it works =

On upload (or from the Media Library), Bender automatically generates two derivatives for every image:

1. **Mosaic atlas** – the image in full resolution, with an N×N grid permuted and flipped via HMAC-SHA256 → Fisher-Yates using a per-image secret key. A single CDN-cacheable file: downloaded as-is, it's an unreadable puzzle.
2. **Signed low-res** – a reduced version with a visible diagonal watermark and IPTC copyright metadata (read by Google Images), used as the `<img>` source: SEO, social previews, and the no-JavaScript fallback.

The original hi-res URL never appears in the page markup. In the browser, Bender waits for the image to enter the viewport, downloads the atlas, requests the reconstruction map from a REST endpoint protected by a time-limited HMAC token, and reassembles the mosaic on a `<canvas>` with a blur-up cross-fade.

= What it blocks (and what it honestly doesn't) =

* HTML scrapers / mass bots — blocked: the HTML only contains the watermarked low-res
* Right-click "Save image" — blocked: the canvas isn't a file
* Hi-res hotlinking — blocked: no plain hi-res URL exists
* Downloading the atlas — useless: permuted, flipped tiles, no map
* Map enumeration via REST — mitigated: time-limited HMAC token, per-IP rate limiting
* Screenshots — not blockable, by any technology

That's why Bender always signs, not just hides: visible watermarking and IPTC metadata make authorship provable even when a copy slips through.

= What's included =

This plugin is fully functional as-is, with no locked or restricted features:

* Automatic protection on upload, unlimited images
* 6×6 mosaic grid
* Visible "Bender™" watermark
* Default IPTC copyright metadata
* JPEG atlas format
* Bulk protect/unprotect from the Media Library

Denser grids, WebP/PNG atlas formats, fully customizable watermark and IPTC text, invisible forensic (LSB) watermarking, and configurable token validity are available in **Bender Pro**, a separate plugin distributed outside WordPress.org.

== Installation ==

1. Upload the `bender-mosaic-image-protection` folder to `/wp-content/plugins/`, or install directly from the Plugins screen.
2. Activate the plugin.
3. Requires PHP 7.4+ with the GD extension (standard on virtually any WordPress hosting).
4. Go to the **Bender** menu to adjust served resolution, quality, and watermark/IPTC toggles. New uploads are protected automatically by default.
5. For existing images: Media Library → select images → **"Protect with Bender"** bulk action.

**Page caching**: align the token validity (24 hours by default) with your page cache duration, so tokens served from cache remain valid.

== Frequently Asked Questions ==

= What is Bender and what does it do? =

Bender is a WordPress plugin that protects images from theft: it breaks them into an unreadable mosaic for scrapers and bots, shows visitors a live canvas reconstruction, and serves search engines a signed low-res version with a watermark and IPTC copyright metadata.

= Does Bender really block downloads of the high-resolution images? =

It blocks automated scrapers, hotlinking, and right-click "Save image", because the HTML never contains a plain hi-res URL. It cannot prevent a screenshot, because no web technology can — that's why every image is still signed with a watermark and IPTC metadata.

= Does Bender slow down the site or hurt SEO? =

No — SEO stays intact and actually improves. The low-res version is a real `<img>` tag with `alt` text, indexable by Google Images, with IPTC metadata enabling the "Licensable" badge. CSS and JS together weigh about 4 KB with zero dependencies.

= What does a visitor without JavaScript see? =

The sharp, watermarked low-res version. There's never a broken image; canvas reconstruction only happens if JavaScript is active.

= Does Bender work with page caching? =

Yes: align the token validity (24 hours by default) with your page cache duration.

= Does Bender require special hosting? =

No — only PHP 7.4+ with the GD extension, standard on virtually any WordPress hosting.

== Screenshots ==

1. Settings page with protection stats.
2. Media Library with the "Protection" column and bulk actions.

== Changelog ==

= 0.1.7 =
* Fixed the "Custom themes / page builders" fallback (`universal_scan`, added in 0.1.6): when the only protected image on a page was reached exclusively through this fallback, the mosaic viewer script/style were enqueued too late to ever be printed (the fallback rewrites the fully-buffered page, which closes after `wp_head`/`wp_footer` already ran), so visitors saw the static low-res `<img>` with no `<canvas>` upgrade — the image looked unprotected even though the server-side markup was correct. Assets are now enqueued as soon as the fallback decides to scan the page, before output buffering starts.

= 0.1.6 =
* Added a fallback for custom-coded themes and page builders that print `<img>` tags outside `the_content()`/`the_post_thumbnail()` (e.g. `wp_get_attachment_image()` called directly, or a raw `<img src="...">` in a hand-built gallery/slider): those images were left completely unprotected before, even after marking the attachment as protected. Bender now also scans the fully rendered page and swaps in the protected version for any image it recognizes. New "Custom themes / page builders" setting to disable this if not needed.

= 0.1.5 =
* Fixed 3 strings (the settings page intro and the "what it stops" note) that silently failed to load their bundled translation because the English source used a straight apostrophe (') while the .po files had a typographic one (’). All 6 bundled languages regenerated.

= 0.1.4 =
* Bundled ready-made translations (Italian, Spanish, French, German, Brazilian Portuguese, Chinese Simplified) in `languages/`, loaded automatically via `load_plugin_textdomain()` — no need to wait for community translations on translate.wordpress.org.

= 0.1.3 =
* All admin-facing strings (settings page, Media Library column, row/bulk actions, admin notices, error messages) are now proper English source strings wrapped for translation with the `bender-mosaic-image-protection` text domain, instead of hardcoded Italian. Translators can now localize the plugin via translate.wordpress.org.

= 0.1.2 =
* The fixed values of this edition (6×6 grid, watermark text/opacity, IPTC copyright/credit, 24h REST token TTL) are no longer implemented through generically-parameterized helper functions called with constant arguments. Each is now hardcoded directly inside the function that uses it (no unused `$n`/`$opacity`/`$ttl`-style parameters left over), so the free codebase itself contains no latent/dormant configurability for these values.

= 0.1.1 =
* All function, class, define, and option/transient names now use the `bendmoim`/`BENDMOIM` prefix (was `bender`/`Bender`, with one stray `pg_rl_` transient key).
* Removed dormant Pro-only code paths from the free codebase (variable grid size, WebP/PNG atlas formats, customizable watermark/IPTC text, LSB steganographic watermark, configurable token TTL) instead of merely locking them via options. This edition now hardcodes the free-tier values described in the plugin's own settings screen.

= 0.1.0 =
* Initial release.

== Upgrade Notice ==

= 0.1.6 =
Custom themes/page builders that print images outside the_content()/the_post_thumbnail() are now protected too — previously those stayed unprotected silently.

= 0.1.5 =
Bugfix: 3 strings weren't picking up their bundled translation due to an apostrophe mismatch — now fixed.

= 0.1.4 =
Adds bundled translations (IT, ES, FR, DE, PT-BR, ZH-CN) — no functional change for English-language sites.

= 0.1.3 =
Admin UI strings are now translatable (were hardcoded Italian) — no functional change.

= 0.1.2 =
Fixed-value features are now implemented without generic/parameterized code paths, per Plugin Review feedback.

= 0.1.1 =
Unique naming prefix and removal of dormant Pro-only code, per Plugin Review feedback.

= 0.1.0 =
Initial release.
