=== Yinga Focus ===
Contributors: yinga
Tags: focal point, images, crop, object-position, responsive images
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 1.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Set the subject of an image once — every placement keeps it in view, on every screen size. Zero bytes of CSS or JavaScript for your visitors.

== Description ==

Responsive design crops images. By default the browser crops from the center — straight through faces, products, and everything else that made the photo worth using. Yinga Focus lets you click the subject of an image once, in the media library, and from that moment every placement on your site keeps it in view.

**How it works**

*   Open any image in the media library and click the subject. A live preview shows exactly what stays visible at nine common aspect ratios, and you can compare with the default center crop before saving.
*   The focal point is stored as native WordPress metadata on the attachment itself. Use the same photo in twenty places — hero, card, thumbnail — and all of them inherit it automatically.
*   On the front end the plugin writes only an `object-position` value. That is **0 KB of CSS and 0 KB of JavaScript** for your visitors, and it is safe by construction: `object-position` only has an effect where your theme already crops. An image that is fully visible today cannot shift.

**What is covered automatically**

*   Featured images, galleries and everything rendered through `wp_get_attachment_image()` — every block theme, GeneratePress, Astra, and friends.
*   Images in post content and in the image, cover and media-text blocks.
*   A report in the admin bar tells you, per page, what happened to each image — and why nothing happened, when nothing did. One click shows the same page without the plugin, for an honest before/after.

**Developer friendly**

*   Full REST API with partial updates and a resolve endpoint that returns the engine result for any aspect ratio.
*   A public PHP API: `yinga_focus_get()`, `yinga_focus_css_position()`, `yinga_focus_resolve()` and more.
*   The crop engine exists in PHP and JavaScript, tested against one shared fixture file — bit-identical results, verified on every release.

**Languages**

The interface is in English and fully translatable. A Dutch translation ships with the plugin; other languages can be contributed through translate.wordpress.org.

**A paid add-on exists**

Everything above is the free plugin, and it solves the focal-point problem for standard WordPress rendering on its own. A separate paid add-on, Yinga Focus Pro, covers the harder cases agencies run into: a safe area, a text zone, editing on the live page, re-cutting hard-cropped files, a page scanner, and Elementor backgrounds. You never need it to use this plugin.

== Installation ==

1. Install and activate the plugin.
2. Open an image in the media library and click "Set focal point".
3. Click the subject, check the previews, and save. That is all — the front end follows automatically.

The behaviour can be tuned under Settings → Media.

== Frequently Asked Questions ==

= Will this change how my site looks right now? =

No. The plugin only writes an `object-position`, which has no effect on images that are not being cropped by your theme. Nothing moves until you set a focal point, and even then only images that were already being cropped shift — toward the subject.

= Where is the data stored? =

As regular WordPress post meta on the attachment, with a schema version and a migration path. Deactivating or removing the plugin never touches your images or your data.

= My hero image does not react. Why? =

The admin-bar report on that page will tell you. The usual causes: the theme writes its own `<img>` tags, the image is a CSS background, or the file is a hard-cropped size. None of those pass through the WordPress image functions, so there is nothing for this plugin to filter. The paid add-on reaches them with a page scanner.

= Does it work with WebP/AVIF? =

Yes. The engine only cares about aspect ratios, not file formats.

== Screenshots ==

1. The focal editor: click the subject, see live what every ratio keeps.
2. Compare mode: the default center crop next to the same image with a focal point.
3. The admin-bar report: what happened to every image on this page, and why.
4. Settings under Settings → Media.

== Changelog ==

= 1.2.1 =
* The admin-bar styles are now added through `wp_add_inline_style()` instead of being printed in the footer.
* The output buffer the admin-bar report uses is now closed explicitly on shutdown, on its own level, instead of being left to PHP.
* Removed the `Update URI` header; it is meant for plugins hosted outside WordPress.org.

= 1.2.0 =
* The version constant now matches the plugin header. It is what browsers use to tell editor builds apart, so after an update you no longer get the previous version's editor from cache.
* Focal data of an image attached to a draft or private post is no longer readable without logging in. An attachment status of `inherit` was being treated as public, which it is not.
* The admin-bar report no longer breaks on images whose title contains a dollar sign.
* Deactivating the plugin no longer flushes the whole site's object cache. It never cleared anything of ours.
* Uninstalling no longer removes a setting that belongs to the paid add-on.
* `breakpoints` is now declared in the REST route schema; it was already accepted and sanitised.
* Hook names are now written out in full (`yinga_focus/...`) and every file guards against direct access in the standard form, so the plugin passes the WordPress.org Plugin Check without warnings on those points.

= 1.1.0 =
* The plugin is now fully translatable. Source strings are English, and a Dutch translation (nl_NL) ships with the plugin; other languages can be contributed through translate.wordpress.org.
* The editor translates itself through `wp.i18n`, so its buttons and hints are translatable as well — they used to be hard-coded.

= 1.0.0 =
* First public release.
* Focal editor in the media library with live previews for nine aspect ratios and a compare mode.
* Automatic application through WordPress rendering (attachment functions, post content, image/cover/media-text blocks).
* Admin-bar report with per-image verdicts and a compare view.
* REST API (partial updates, resolve) and public PHP API.
* Zero front-end payload: no CSS, no JavaScript for visitors.
