=== LOOS Featured Image Automator ===
Contributors: looswebstudio
Tags: og-image, ogp, social-image, featured-image, seo
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 8.1
Stable tag: 0.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Auto-generates a featured image from your post title via the OG Image Maker API, so every post is ready for social sharing without manual work.

== Description ==

LOOS Featured Image Automator builds an OG Image Maker URL from your post title and site-wide API parameters defined on the settings screen, fetches the generated 1200x630 JPEG, sideloads it into the WordPress Media Library, and attaches it to the post as the featured image.

Generation runs asynchronously through WP-Cron, so saving a post is never blocked by the API call.

= What this plugin does =

* Builds an API URL from your post title and the site-wide parameters configured on the settings screen.
* Resolves the 302 redirect from the API to extract a stable source hash, so identical parameters do not re-generate the image.
* Sideloads the JPEG into the Media Library and attaches it as the featured image.
* When the title changes, regenerates the image and (optionally) deletes the previous plugin-generated attachment so the Media Library does not accumulate orphans.
* Respects manually-set featured images. If the existing featured image was not generated by this plugin, it is never overwritten.

= What this plugin does NOT do =

* It does NOT output an `og:image` meta tag. The image is set as the featured image only. Your theme or SEO plugin is expected to read the featured image and output the meta tag (this avoids duplicate output when combined with SEO plugins).
* It does NOT provide any per-post UI (no meta box, no Gutenberg sidebar). The only per-post value is the post title; all other API parameters are managed globally on the settings screen.
* It does NOT modify the front-end output of your site.

This plugin depends on a third-party service (operated by LOOS Inc.) to generate featured images. See the "External services" section below for the full disclosure (endpoints, what is sent, and when).

== External services ==

This plugin relies on the following third-party service operated by LOOS Inc. to generate featured images. Activating the plugin and saving a post on a target post type causes data to be sent to this service.

**OG Image Maker API (and its CDN delivery host)**

* Endpoints:
    * API: https://loos.tools/ogimg-maker/api
    * Generated JPEG delivery (CDN): https://og-cdn.loos.tools/
* What is sent:
    * To the API: the post title (as the `title` query parameter) and the API parameters configured on the plugin settings screen (e.g. `type`, `layout`, `mode`, `panel`, `frame`, `radii`, `pattern`, OKLCH `h` / `c` / `l`, and resolved `head` / `foot` text).
    * To the CDN: only the standard HTTP request to download the generated JPEG (no plugin-specific payload other than the URL path identifying the image).
* When data is sent: When WP-Cron processes a queued generation job for a target post. The plugin issues a HEAD request to the API to obtain a 302 redirect to a CDN URL, then downloads the generated JPEG from the CDN into the WordPress Media Library. Repeated requests for the same source hash are skipped.
* Terms of Service: https://loos.tools/terms/
* Privacy Policy: https://loos.tools/privacy/

If you do not wish to send data to this service, do not activate the plugin.

== Installation ==

1. Upload the `loos-featured-image-automator` directory to the `/wp-content/plugins/` directory, or install via the Plugins screen in WordPress.
2. Activate the plugin through the Plugins screen.
3. Go to Settings > LOOS Featured Image Automator and configure the target post types and the default API parameters (type, layout, mode, OKLCH color, etc.).
4. Save a post in a target post type. The featured image will be generated on the next WP-Cron run.

== Frequently Asked Questions ==

= Does this plugin output an og:image meta tag? =

No. The plugin only attaches the generated image as the featured image. Your theme or SEO plugin is expected to output the `og:image` meta tag from the featured image. This design avoids duplicate `og:image` output when combined with SEO plugins.

= What happens if I set the featured image manually? =

A manually-set featured image is never overwritten. If the current featured image was not generated by this plugin, the plugin will skip generation for that post entirely.

= What happens when I change the post title? =

On the next WP-Cron run after the post is saved, the plugin rebuilds the API URL with the new title. If the resulting image differs from the previous one, a new image is generated and attached. If the "Delete the previous auto-generated image" option is enabled (default), the previous auto-generated image is removed from the Media Library.

= Is there a UI in the block editor? =

No. There is no per-post meta box or Gutenberg sidebar. All API parameters are managed site-wide on the settings screen. The only per-post value is the post title.

= Does the plugin send any personal data? =

Only the post title and the site-wide API parameters configured on the settings screen are sent to the OG Image Maker API.

== Screenshots ==

1. Example of an auto-generated featured image, built from the post title via the OG Image Maker API.
2. Settings screen: target post types and OG Image Maker API parameters.

== Changelog ==

= 0.2.0 =
* Improved: Re-saving a post without any change that affects the generated image no longer contacts the OG Image Maker API. The request URL is fingerprinted locally, so an unchanged re-save is detected without issuing a request upstream (#1).
* i18n: Completed the Japanese (ja) translation.

= 0.1.0 =
* Initial release.
