=== Image Generator – AI Auto Featured Images, Thumbnails & Post Images ===
Contributors: beautifulplugins
Tags: ai, ai image, image generator, featured image, block editor
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.8.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI image generator for WordPress. Auto-create featured images, post thumbnails & post images with templates or custom AI prompts.

== Description ==

[**Image Generator**](https://beautifulplugins.com/plugins/image-generator-pro/) is the all-in-one **AI image generator and automatic featured image plugin for WordPress**. Create eye-catching **featured images, post thumbnails, hero banners, and social media images** in two clicks — directly inside the **Gutenberg block editor**, or automatically every time you publish a post or page.

Stop switching between design tools, AI apps and stock photo sites. Stop publishing posts with broken thumbnail spots. With **Image Generator** you can:

- **Design your own image templates** in a visual **Template Studio** and turn every post title into an on-brand image — free, rendered on your own server.
- **Generate AI images** from a custom prompt using **OpenAI GPT Image** (your own API key) — right inside the block editor.
- **Search free stock photos** from **Unsplash, Pexels and Pixabay** without leaving WordPress, imported with the photographer's credit.
- **Combine them**: put a stock photo or an AI image under your own template design, so each post gets a different picture with your logo, colors and title.
- **Auto-generate featured images** whenever a post or page is saved without one — from a template, AI or a stock photo.
- **Insert images** straight into Image and Media & Text blocks while you write, or **set the featured image** with one click from the **AI Featured Image** sidebar panel.

= Where Your Images Come From =

1. **Your own image templates** — designs you build in the Template Studio (or start from 10 ready-made ones). The post title and other details are filled in and the image is drawn on your server with PHP's GD library. No API key, no cost, nothing leaves your site (unless a layer uses a stock photo or AI image).
2. **AI images** — unique images from OpenAI GPT Image, written from your prompt or from the post's title and excerpt. Needs your own OpenAI API key.
3. **Free stock photos** — **Unsplash**, **Pexels** and **Pixabay**. Needs a free API key from the library you use.
4. **Templates over photos** — any template's background or image layer can show a stock photo or an AI image picked for each post.

Images inside your templates can come from your **Media Library**, the **post's featured image**, the **first image in the post**, your **site logo** or **site icon**, the **author's avatar** (uploaded to the Media Library), a **stock photo for the post** or an **AI image for the post**.

Whether you run a blog, news site, magazine, portfolio, affiliate site, online store, or membership platform, this plugin gives every post a polished, **SEO-friendly featured image** — without the manual work.

[**🚀 Upgrade to Pro**](https://beautifulplugins.com/plugins/image-generator-pro/) | [**📄 Plugin Documentation**](https://beautifulplugins.com/docs/) | [**💻 Support**](https://beautifulplugins.com/contact/)

= Two Powerful Ways to Create Images =

1. **Inside the block editor or the Media Library (on demand)**: make an image from a template, an AI prompt or a stock photo while you're writing, and drop it straight into an Image block, a Media & Text block, or set it as the post's Featured Image.
2. **Automatic on publish (hands-off)**: when a post or page has no featured image, the plugin creates one for you — **from your own image template** (free, instant, on-brand), **with AI** (a unique image written from the post's title and excerpt) or **from a stock photo** that matches the post title. You choose the method in Settings, and each one can fall back to a template.

Every image — template-rendered, AI-created or a stock photo — is saved to the **WordPress Media Library** with proper alt text, so it works with any theme, page builder, CDN, image-optimization plugin, lazy loader, or SEO plugin.

= Watch video tutorial on how to use the Image Generator plugin =

[youtube https://www.youtube.com/watch?v=GmFg7iXddP8]

= Why Featured Images Matter for SEO and Engagement =

- **Higher search rankings**: Google rewards visually rich content with better placement in search results and Google Discover.
- **Better click-through rates**: posts with attractive thumbnails get noticeably more clicks from search results, archive pages, and category listings.
- **More social shares**: Facebook, Twitter/X, LinkedIn, and Pinterest all use the featured image when someone shares your URL. No featured image = no preview = fewer clicks.
- **Pinterest traffic**: pin-worthy custom images can drive long-tail referral traffic for years.
- **Brand consistency**: reusable templates keep every post on-brand without hiring a designer.
- **Improved Core Web Vitals**: properly attached, optimized featured images load predictably and avoid layout shift.

= Perfect For =

- Bloggers who publish daily and never want to think about featured images again.
- News sites and magazines that need every article to have a thumbnail.
- WooCommerce stores that need product placeholder images.
- Affiliate marketers who want unique hero images for every roundup post.
- Agencies and freelancers managing multiple client sites.
- Membership and learning platforms that publish lots of lessons.
- Anyone who has ever shipped a post with a missing or generic thumbnail.

== Key Features ==

✅ **AI Image Generation with OpenAI**
Plug in your **OpenAI API key** (or define the `AIMG_API_KEY` constant in `wp-config.php`) and generate unique images from natural-language prompts *"a sunlit forest path in autumn, photorealistic, soft lighting"*, without leaving WordPress.

✅ **Block Editor (Gutenberg) Integration**
Adds an **"AI Generate" sparkle button** to the toolbar of core Image and Media & Text blocks, plus a dedicated **AI Featured Image panel** in the document sidebar. No setup, no shortcodes, it just shows up.

✅ **Templates, AI and Stock Photos in One Modal**
A single modal lets editors switch between **Templates** (fast, on-brand, free), **Custom Prompt** (AI-generated, unique) and one tab each for **Unsplash**, **Pexels** and **Pixabay**. It opens from the block editor and from the Media Library, and remembers the tab you used last.

✅ **Free Stock Photos from Unsplash, Pexels & Pixabay**
Search millions of free photos in the editor and the Media Library, filter by orientation and color, and insert one with a click. Each photo is downloaded into your Media Library with alt text and the photographer's credit in the caption. Stock photos can also be the automatic featured image, picked with keywords from the post title. Each library needs its own free API key.

✅ **On-Brand Photos: Templates over Stock or AI Images**
Use a stock photo or an AI image as a template's background or image layer, and every post gets a different picture with your logo, colors and title on top. The picture is fetched once per post in the background and reused when you regenerate.

✅ **Visual Template Studio**
Design image templates on a canvas: drag, resize and rotate layers, with snapping guides, undo/redo and keyboard shortcuts. Combine backgrounds (colors, random palettes, gradients or an image), images with rounded or circle masks, brightness, contrast, blur, black and white and duotone, see-through overlays and fades, shapes, patterns, frames and text. Background and image layers can use a Media Library image, the post's featured image, the first image in the post, the site logo or icon, the author's avatar, or a stock photo or AI image picked for each post. Text fits itself to its box, with 11 bundled fonts (or upload your own .ttf/.otf), outlines, shadows, highlight boxes and tags like `{title}`, `{category}`, `{author}`, `{date}` and `{custom_field:key}`. Preview with long titles or a real post, check the exact image your server will make, start from 10 ready-made designs, and import or export designs as JSON.

✅ **Unlimited Reusable Image Templates**
Build as many image templates as you want. Each template is rendered server-side using PHP's GD library, no external dependency — the canvas you design on draws the same way, so what you see is what your posts get.

✅ **Automatic Featured Image on Save — Template, AI or Stock Photo**
When a post or page is saved without a featured image, the plugin creates one. Choose from: **Image template** (a random one, or the one you pick), **AI image**, **Stock photo** (Unsplash, Pexels or Pixabay, found with keywords from the post title), or a combination — template with AI as a fallback, AI with a template as a fallback, or a stock photo with a template as a fallback. AI images, stock photos and templates with a stock or AI layer are made in the background, so saving never waits on an outside service, and the editor shows the progress.

✅ **Smart AI Prompts**
Write your prompt template once with tags like `{title}`, `{excerpt}`, `{category}`, `{tags}` and `{custom_field:key}`, choose a style (Photorealistic, Flat illustration, 3D render, Watercolor, Cinematic and more), and every post gets a fitting prompt. A built-in instruction keeps garbled text and watermarks out of the image.

✅ **Image Shape, Quality and Variations**
Choose square, landscape or portrait images and the quality level (and so the cost). In the editor, generate up to 4 variations and keep the one you like — the others are removed from the Media Library.

✅ **Cost Control**
Decide which roles can use AI and set an hourly limit per user. Automatic AI images wait until a post is published, so drafts don't spend credit.

✅ **Works Anywhere You Edit**
Automatic generation currently covers **posts and pages**. On-demand generation is not limited that way: the block editor panel and the Media Library modal let you generate an image and set it as the featured image on **any post type that supports featured images**, including WooCommerce products and custom post types.

✅ **Native WordPress Media Library**
Every image — template, AI or stock photo — is **saved into the Media Library** with alt text. So image optimization plugins (Smush, ShortPixel, Imagify, EWWW), CDNs (Cloudflare, BunnyCDN, KeyCDN), and SEO plugins (Yoast, Rank Math, AIOSEO) all see it as a regular attachment.

✅ **REST API for Headless & Custom Workflows**
Endpoints (`/wp-json/aimg/v1/generate`, `/templates`, `/featured/{post}`, `/status/{post}`, `/prompt`, `/stock/{library}/search`, `/stock/{library}/import`) with capability checks and nonce protection, perfect for **headless WordPress, decoupled frontends, and automation scripts**.

✅ **Developer-Friendly Filters**
Add your own AI provider (`aimg_providers`), stock photo library (`aimg_stock_providers`), template layer type (`aimg_template_layers`), merge tag (`aimg_merge_tags`), modal tab (`aimgModal.tabs`), generation method (`aimg_generation_methods`, `aimg_pre_generate_for_post`) or style preset (`aimg_style_presets`), adjust prompts (`aimg_post_prompt`), and keep using `aimg_generate_endpoint` and `aimg_generate_request_body` to customize the OpenAI request.

✅ **Translation Ready (i18n)**
Fully translatable via the bundled `.pot` file, both PHP and editor JavaScript strings are registered with `wp_set_script_translations`. Compatible with WPML, Polylang, Loco Translate, and TranslatePress.

✅ **Lightweight, Fast, and Secure**
No bloated dependencies. Uses native WordPress components, the GD library (already part of PHP), and the REST API. API keys can be stored outside the database with the `AIMG_API_KEY`, `AIMG_UNSPLASH_KEY`, `AIMG_PEXELS_KEY` and `AIMG_PIXABAY_KEY` constants, and stock photos are only downloaded from each library's own image servers.

✅ **No Coding Required**
Simple admin UI under **Image Generator** in the WordPress dashboard. Build a template, save your settings, you're done.

== How It Works ==

= Generate from the Block Editor (On Demand) =

1. Open any post or page in the **Gutenberg editor**.
2. Click the ✨ sparkle icon in the toolbar of an **Image** or **Media & Text** block or open the **AI Featured Image** panel in the document sidebar.
3. Choose a tab in the modal:
   - **Templates**: pick a saved image template and see a preview with your post title. The title text defaults to the current post title.
   - **Custom Prompt**: describe the image you want — or click *Write a prompt from this post* — pick the shape, style, quality and number of variations, and press *Generate* (or Ctrl + Enter / ⌘ + Enter).
   - **Unsplash**, **Pexels** or **Pixabay**: search is filled in with keywords from the post title; filter by orientation and color, scroll for more, pick a photo and press *Insert Photo*.
4. The image is added to the Media Library and **inserted into the block** or **assigned as the featured image** automatically. With several AI variations, you pick one first.

The **AI Featured Image** panel can also (re)generate the featured image in one click using your automatic method. The same modal is available from **Media → Library → Generate Image**, so you can create images with any editor.

= Auto-Generate Featured Images on Publish =

1. Under **Image Generator → Settings → Automatic Featured Images**, choose **Image template**, **AI image** or **Stock photo** (or one with a fallback).
2. Write your post or page as normal and hit **Publish** or **Update**.
3. If you already set a featured image, nothing happens.
4. If you didn't, a template image is rendered right away from the post title — or an AI image or stock photo is fetched in the background — saved to the Media Library and attached as the post thumbnail.

== Use Cases ==

= Daily Bloggers =
Publish a post, hit Update, and walk away. Your readers and Google get a polished featured image every time, without you ever opening Canva.

= News and Magazine Sites =
Generate consistent on-brand thumbnails for breaking news pieces and category archives, no designer in the loop.

= WooCommerce Stores =
Auto-generate placeholder product images for new SKUs while real photos are still being shot. Then replace at your own pace.

= Affiliate Roundups and Listicles =
Use **Custom Prompt** mode to generate unique hero images for *"Best Standing Desks 2026"* style posts that don't look like every other affiliate site.

= Agencies and Multi-Site Networks =
Configure templates once, set them as defaults across all client sites, and stop fielding *"why doesn't this post have an image?"* tickets.

= Headless and Decoupled Sites =
Use the REST API endpoints to trigger image generation from a Next.js, Astro, or Gatsby frontend, a CLI script, or a CI pipeline.

== Image Generator vs. Manual Workflows ==
Without Image Generator | With Image Generator

* **Add a featured image to a new post** — Without: find a stock photo, download, upload, set as featured. With Image Generator: publish — done.
* **Generate a unique hero image** — Without: open Midjourney/ChatGPT, save, upload, insert. With Image Generator: click ✨ in the toolbar, type a prompt, done.
* **Use a free stock photo** — Without: search a stock site, download, upload, add the credit. With Image Generator: search in the editor, click *Insert Photo* — credit included.
* **Keep thumbnails on-brand across the site** — Without: manual design work, every post. With Image Generator: build a template once, reused forever.
* **Generate placeholders for 50 imported posts** — Without: tedious manual upload. With Image Generator: bulk-saving triggers auto-generation.

== Installation ==

= Automatic Installation =
1. Go to **Plugins → Add New** in your WordPress admin.
2. Search for **"Image Generator"** by BeautifulPlugins.
3. Click **Install Now**, then **Activate**.

= Manual Installation =
1. Download the plugin ZIP file.
2. Upload the `artificial-image-generator` folder to `/wp-content/plugins/`.
3. Activate **Image Generator** through the **Plugins** menu in WordPress.

= Setup =
1. Go to **Image Generator → Image Templates → Add New**, pick one of the ready-made designs (or start blank) and adjust it in the Template Studio.
2. (Optional) Open **Image Generator → Settings** and add your **OpenAI API key** to enable AI images.
3. (Optional) Under **Settings → Stock Photos**, add a free key from Unsplash, Pexels or Pixabay and click **Test Connection**.
4. (Optional, more secure) Define the keys in `wp-config.php` instead:
   `define( 'AIMG_API_KEY', 'sk-your-key-here' );` (and `AIMG_UNSPLASH_KEY`, `AIMG_PEXELS_KEY` or `AIMG_PIXABAY_KEY`)
5. Done. Generate from the block editor or the Media Library, or just publish a post and let the plugin handle it.

== Frequently Asked Questions ==

= Do I need an API key to use this plugin? =
**No — only for AI prompt-based generation and stock photos.** Template-based image creation, including the automatic featured image on publish, runs entirely on your own server using PHP's built-in GD library. No external services, no API calls, no recurring costs — unless you give a template a stock photo or AI image layer. Stock photos need a free API key from Unsplash, Pexels or Pixabay; you only need one.

= How do I get free stock photo API keys? =
Create a free key at [Unsplash](https://unsplash.com/oauth/applications), [Pexels](https://www.pexels.com/api/new/) or [Pixabay](https://pixabay.com/api/docs/), then paste it under **Image Generator → Settings → Stock Photos** and click **Test Connection**. You can also define `AIMG_UNSPLASH_KEY`, `AIMG_PEXELS_KEY` or `AIMG_PIXABAY_KEY` in `wp-config.php`. New Unsplash keys are limited to 50 searches an hour until Unsplash approves them for production.

= Can I design my own image templates? =
**Yes.** Go to **Image Generator → Image Templates → Add New** to open the Template Studio. Start from one of 10 ready-made designs or a blank canvas, add backgrounds, images, overlays, shapes, patterns, frames and text, and use tags like `{title}`, `{category}` or `{custom_field:key}` so each post gets its own text. Templates are drawn on your server, so they cost nothing to use. You can export a template as JSON and import it on another site.

= Which images can I use inside a template? =
Background and image layers can show an image from your **Media Library**, the **post's featured image**, the **first image in the post**, the **site logo**, the **site icon**, the **author's avatar** (uploaded to the Media Library), a **stock photo picked for the post** (Unsplash, Pexels or Pixabay, searched with the post title or your own search text) or an **AI image made for the post** (from your own prompt). Stock and AI images are fetched once per post, in the background, and reused when you regenerate.

= Do I need to credit stock photographers? =
Unsplash, Pexels and Pixabay photos are free to use, and the libraries ask you to credit photographers where you can. The plugin adds a credit with links to the image caption (you can turn this off under Settings → Stock Photos) and always saves it with the image.

= Which AI image generation service is supported? =
Out of the box, the plugin calls **OpenAI's Images API** using **GPT Image 2.5 Flare** by default — you can switch to GPT Image 2.5 Sunburst or GPT Image 2 under **Image Generator → Settings**. Models OpenAI has retired (GPT Image 1, DALL·E 2 and DALL·E 3) are no longer offered; sites that used them switch to GPT Image 2.5 Flare automatically. Developers can swap the endpoint, model, or request body via the `aimg_generate_endpoint` and `aimg_generate_request_body` filters — so you can point it at compatible services (Stability AI, self-hosted SDXL via a compatible proxy, etc.).

= How much does AI image generation cost? =
You pay OpenAI directly for usage, based on the model, image size and quality; see OpenAI's pricing page for current rates. Larger shapes, higher quality and more variations cost more. The plugin itself is free; you only pay your AI provider for the images it creates. To keep costs predictable, limit AI to certain roles, set an hourly limit per user, and use templates for everyday posts. Automatic AI images are only created when a post is published or scheduled, not for drafts.

= Where is my OpenAI API key stored? =
By default, it's stored in the `aimg_settings` option in the WordPress database. **For maximum security**, define `AIMG_API_KEY` in `wp-config.php` instead — the settings UI will detect the constant and disable the input field, so the key never sits in the database.

= Will this plugin generate featured images for existing posts? =
Automatic generation only fires when a post is saved without a featured image. **For existing content**, open the post in the block editor and use the **AI Featured Image** panel to generate one on demand. Bulk generation across the entire site is on the roadmap.

= Does it work with the Gutenberg block editor? =
**Yes.** The block editor integration is the plugin's flagship feature. You'll find the ✨ button on Image and Media & Text block toolbars and a dedicated **AI Featured Image** panel in the document sidebar.

= Does it work with the Classic Editor, Elementor, Divi, Beaver Builder, or Bricks? =
The editor buttons are built for Gutenberg, but the same modal is available in **Media → Library → Generate Image**, so you can create template, AI and stock images there and use them in any builder. **Automatic featured image generation works with every editor**, because it runs whenever WordPress saves a post — so Classic Editor, Elementor, Divi, Beaver Builder, Bricks, and any other builder all benefit from auto-generated thumbnails.

= Does it work with WooCommerce products? =
**On demand, yes.** Open a product, download, course, or any custom post type that supports featured images, and use the AI Featured Image panel or the Media Library modal to generate and assign an image. Automatic generation on save currently covers posts and pages only; extending it to every public post type is next on the roadmap.

= Does it work with SEO plugins like Yoast SEO, Rank Math, and All in One SEO? =
**Yes.** Generated images are stored as standard Media Library attachments with proper alt text, so SEO plugins can read them, expose them in Open Graph and Twitter Card tags, and include them in sitemaps.

= Will it slow down my site? =
**No.** Template rendering uses PHP's GD library (already loaded) and only runs when a post is saved without a featured image — or when you explicitly trigger it from the editor. Automatic AI images and stock photos are fetched in a single background task per post (Action Scheduler when available, otherwise WP-Cron), so saving a post never waits for an outside service. There's no frontend overhead.

= I moved a site that ran on a Windows server. Why do some older generated images point to the old folder? =
On Windows, versions before 1.4.9 saved the full file path of generated images (for example `C:/sites/example/wp-content/uploads/2026/04/image.png`) instead of the path inside the uploads folder. They keep working on the same server. After a move, back up your database and remove the old uploads prefix, for example with WP-CLI: `wp search-replace 'C:/sites/example/wp-content/uploads/' '' wp_postmeta --dry-run` (run it again without `--dry-run` once the result looks right). Images generated with 1.4.9 or later are not affected.

= Is it compatible with multisite? =
Yes. Each site on the network can configure its own templates and API keys.

= Is the plugin GDPR-friendly? =
Template-based generation runs entirely on your server, nothing leaves your site (except for templates with a stock photo or AI image layer). Stock photo searches send only search terms (what you type, or keywords from the post title) to the library you use. AI generation sends only a prompt to OpenAI: the text you type, or — for automatic AI images and the *Write a prompt from this post* button — a prompt built from your prompt template, which by default contains the post's title and excerpt. No visitor data is ever sent. If your posts contain personal information, edit the prompt template so it doesn't include it.

= Can I translate the plugin? =
**Yes.** The plugin is fully translation-ready with a bundled `.pot` file. Both PHP and JavaScript strings are translatable.

= How can I report a bug or request a feature? =
Use the [plugin support forum on WordPress.org](https://wordpress.org/support/plugin/artificial-image-generator). We read every post.

== Troubleshooting ==

- **"No API key configured" notice in the editor**: add a key under **Image Generator → Settings**, or define `AIMG_API_KEY` in `wp-config.php`.
- **Thumbnails not displaying on the frontend**: make sure your theme calls `add_theme_support( 'post-thumbnails' )` in `functions.php`.
- **AI generation fails or times out**: check that your server can make outbound HTTPS requests, that PHP's `max_execution_time` is at least 60 seconds, and that your OpenAI API key has billing enabled.
- **"The model … does not exist" (or similar) error**: your OpenAI account doesn't have access to the selected model. Pick another **Image Model** under **Image Generator → Settings**; GPT Image 2.5 Flare is the default.
- **"No templates available" in the editor modal**: create at least one template under **Image Generator → Image Templates**.
- **A stock photo tab asks for an API key**: add a free key for that library under **Image Generator → Settings → Stock Photos** and click **Test Connection**.
- **"… has had too many requests from this site"**: the stock library's hourly limit is used up. Wait an hour, or apply for production access (Unsplash allows 50 searches an hour until then).
- **Image looks wrong**: open the template in the Template Studio and click **Exact preview** to see the image your server makes; check layer order, colors and the image source of each layer.
- **Cache plugins showing stale images**: clear page, object, and CDN caches after generating new images.
- **Compatibility issues**: temporarily disable other plugins to identify conflicts and let us know via the support forum.

== Best Practices ==

✅ Build **3–5 well-designed templates** so the random fallback always looks on-brand.
✅ Use **Custom Prompt** mode for hero images and standout posts; use **Templates** for everyday post thumbnails.
✅ For photo-style thumbnails that still look like your brand, use a template with a **stock photo** background.
✅ Keep prompts **specific** — *"a sunlit forest path in autumn, photorealistic, soft lighting"* beats *"forest"*.
✅ Define `AIMG_API_KEY` in `wp-config.php` rather than storing it in the database.
✅ Pair this plugin with an image optimization plugin (Smush, ShortPixel, Imagify) so generated images load fast.
✅ Set a recognizable brand color in your templates so visitors associate the look with your site.

== Third-Party Assets and Licenses ==

= Roboto Font =
Author: Christian Robertson
License: Apache License 2.0
License URI: https://www.apache.org/licenses/LICENSE-2.0
Source: https://fonts.google.com/specimen/Roboto

The Roboto font is bundled under the Apache License 2.0. Full license text available at the URI above.

= Template Studio Fonts =
Roboto (Regular), Inter, Montserrat, Poppins, Playfair Display and Noto Sans are bundled for the Template Studio.
License: SIL Open Font License 1.1
License URI: https://openfontlicense.org
Source: https://fonts.google.com

Each font's license, with its copyright notice, ships in `assets/fonts/licenses/`.

= AI Image Generation =
AI image generation calls a third-party API (**OpenAI** by default, `https://api.openai.com/v1/images/generations`). You are responsible for the API key, usage costs, and compliance with the provider's [terms of use](https://openai.com/policies/terms-of-use) and [privacy policy](https://openai.com/policies/privacy-policy). **Nothing is sent to an external service unless you add an API key and either generate from a prompt, click *Write a prompt from this post*, choose an AI method for automatic featured images, or use a template with an AI image layer.** Other template-based generation never leaves your server.

= Stock Photos =
Searching or importing stock photos calls the library you choose: **Unsplash** (`api.unsplash.com`, images from `images.unsplash.com`), **Pexels** (`api.pexels.com`, images from `images.pexels.com`) or **Pixabay** (`pixabay.com/api`, images from `pixabay.com`). The plugin sends your API key and the search terms — what you type, or keywords from the post title (or the template's search text) for automatic images. **Nothing is sent unless you add a key and search, test the key, choose a stock method for automatic featured images, or use a template with a stock photo layer.** Thumbnails in search results are loaded from the library in the editor, as the libraries require; the photo you pick is downloaded to your Media Library. Unsplash: [terms](https://unsplash.com/terms), [API guidelines](https://help.unsplash.com/en/articles/2511245-unsplash-api-guidelines), [privacy](https://unsplash.com/privacy). Pexels: [terms](https://www.pexels.com/terms-of-service/), [license](https://www.pexels.com/license/), [privacy](https://www.pexels.com/privacy-policy/). Pixabay: [terms](https://pixabay.com/service/terms/), [license](https://pixabay.com/service/license-summary/), [privacy](https://pixabay.com/service/privacy/).

== Privacy ==

- **Template-based generation** runs entirely on your server. No data is sent to third parties, unless a template has a stock photo or AI image layer (then the same rules as below apply).
- **AI generation** sends a prompt to OpenAI (or your configured endpoint): the prompt you type, or — for automatic AI images — one built from your prompt template, which by default includes the post's title and excerpt. No user or visitor data is transmitted.
- **Stock photo searches** send search terms to the library you use (Unsplash, Pexels or Pixabay). No user or visitor data is transmitted.
- The plugin does not set cookies, track users, or load any external scripts on the frontend.

== Screenshots ==
1. Block editor — the ✨ button on Image and Media & Text blocks opens the image generator.
2. AI Featured Image panel in the post sidebar — regenerate the featured image in one click, or choose a template, stock photo or prompt.
3. Templates tab — preview any of your templates with the post title before you add it.
4. Custom Prompt tab — write a prompt (or build one from the post) and pick the shape, style, quality and number of variations for an AI image.
5. Free stock photos from Pixabay, searched with keywords from the post title, with the photographer credit.
6. Pexels tab — filter stock photos by orientation and color and scroll for more.
7. Media Library — Generate Image opens the same modal, so it works with any editor or page builder.
8. A stock photo imported into the Media Library with alt text, title and the photographer credit in the caption.
9. Image Templates — your templates as a grid with previews; duplicate, set as default, export or delete.
10. Start from a design — ready-made templates, including stock photo designs (the review, sale, course, recipe and price tag designs come with Pro).
11. Template Studio — edit layers on a canvas; text fits its box and uses tags like {title} and {category}.
12. Template Studio — a background that shows a stock photo picked for each post, with your design on top.
13. Template Studio — layer types: background, image, overlay, text, shape, pattern and frame (Rating, Progress bar and Badge come with Pro).
14. Settings — automatic featured images with a template, AI or a stock photo, and the AI prompt and style.
15. Settings — AI service: API key, model, image shape and quality, who can use AI and an hourly limit.
16. Settings — stock photo API keys with Test Connection, and the library, orientation, size and credit options.

== Changelog ==
= 1.8.0 ( 11th October 2026 ) =
* New: **Free stock photos from Unsplash, Pexels and Pixabay.** Search them in the editor and the Media Library with orientation and color filters, and insert one with a click. Photos are imported with alt text and the photographer's credit, and importing the same photo again reuses it.
* New: Stock photos as an automatic featured image method ("Stock photo" or "Stock photo, template if none is found"), picked with keywords from the post title in the background.
* New: **Hybrid templates.** A background or image layer can show a stock photo or an AI image made for each post, with your design on top. Two new starters use it.
* New: Stock Photos settings with a Test Connection button; keys can also be set with `AIMG_UNSPLASH_KEY`, `AIMG_PEXELS_KEY` and `AIMG_PIXABAY_KEY`.
* Enhance: Templates made before 1.7.0 are converted to the Template Studio format in the background, only when they look exactly the same; any that would change keep working as before and are listed in Site Health. Their old settings are kept.
* Enhance: The default background and text colors in Settings now apply to new templates; existing templates keep the colors they were saved with.
* Dev: Modal tabs can be added with the JS filter `aimgModal.tabs` (action `aimg_enqueue_modal`); new filters `aimg_stock_providers`, `aimg_stock_keywords`, `aimg_stock_stop_words`, `aimg_stock_max_bytes`, `aimg_unsplash_app_name`, `aimg_sanitize_settings`, `aimg_merge_tag_names` and `aimg_studio_sample_tags`; REST endpoints under `/aimg/v1/stock`.
* Removed: `aimg_generate_preview()`, deprecated in 1.7.1.

= 1.7.1 ( 9th October 2026 ) =
* Enhance: The Template Studio is now the only template editor. Templates made before 1.7.0 open in the Studio and look exactly the same; saving them there keeps their old settings too, so downgrading still works.
* Enhance: Duplicating an older template now creates a Studio copy.
* Removed: The classic template form and its save handler.
* Dev: Add-ons can add Template Studio layer types with the JS filter `aimg.studio.layerTypes` (scripts enqueued on the new `aimg_enqueue_template_studio` action) together with `aimg_template_layers`.
* Enhance: Layers of a type whose plugin is not active are kept in the template instead of being removed, and are shown as unavailable.
* New: "Extra high" and "Maximum" AI image quality for GPT Image 2.5 Flare and Sunburst (GPT Image 2 uses High).
* Enhance: AI requests now wait up to 3 minutes instead of 2, so slow or high-quality images are not cut off. The `aimg_generate_timeout` filter also receives the model and quality.
* Deprecated: `aimg_generate_preview()`; use `ArtificialImageGenerator\Templates\Repository::update_preview()`. It will be removed in 1.8.0.

= 1.7.0 ( 7th October 2026 ) =
* New: **Visual Template Studio.** Design templates on a canvas with layers you can drag, resize and rotate, with snapping guides, undo/redo and keyboard shortcuts.
* New: Layer types for backgrounds (color, random palette, gradients, images, the post's featured or first image), images (rounded or circle masks, brightness, contrast, blur, black and white, duotone), overlays and gradient fades, shapes, patterns, frames and text.
* New: Text fits its box, with max lines, letter case, letter spacing, outline, shadow and highlight boxes, plus tags `{title}`, `{excerpt}`, `{category}`, `{tags}`, `{author}`, `{date}`, `{site_name}`, `{reading_time}` and `{custom_field:key}`, and layers that show only when a tag has a value.
* New: 10 more bundled fonts (Roboto, Inter, Montserrat, Poppins, Playfair Display, Noto Sans), font uploads (.ttf/.otf), and the theme's color palette as swatches.
* New: Preview with short, long or very long titles or a real post, and an exact preview rendered by your server.
* New: Start from 8 ready-made designs, import and export designs as JSON, and duplicate templates.
* New: The templates list shows large previews with Edit, Duplicate, Set as default, Export and Delete.
* New: REST endpoints for managing templates (`/templates`, `/templates/{id}`, `/templates/preview`, `/fonts`, `/capabilities`) and developer filters `aimg_template_layers`, `aimg_fonts`, `aimg_merge_tags`, `aimg_template_document`, `aimg_template_starters` and `aimg_manage_templates_capability`.
* Enhance: Template images made from the editor are now attached to their post in the Media Library.
* Compatibility: Existing templates look exactly as before and keep their settings; they switch to the Studio only when you save them there. The classic form stays available for templates you haven't changed.

= 1.6.0 ( 6th October 2026 ) =
* New: **Template or AI for automatic featured images.** Choose under Settings → Automatic Featured Images: an image template (default, as before), an AI image, or either one with the other as a fallback.
* New: Pick which template automatic images use, instead of a random one.
* New: AI prompt template with tags (`{title}`, `{excerpt}`, `{category}`, `{tags}`, `{site_name}`, `{custom_field:key}`), style presets, and instructions that keep text and watermarks out of AI images.
* New: Automatic AI images are created in the background (Action Scheduler or WP-Cron), only once a post is published or scheduled, and count against the post author's hourly limit.
* New: The AI Featured Image panel shows background progress and can generate or regenerate the featured image in one click.
* New: In the Custom Prompt tab, choose the image shape (square, landscape, portrait), quality, style and up to 4 variations, or write the prompt from the post.
* New: The Templates tab previews the selected template with your title.
* New: Default AI image shape and quality settings.
* New: Developer hooks `aimg_providers`, `aimg_generation_methods`, `aimg_pre_generate_for_post`, `aimg_template_for_post`, `aimg_style_presets`, `aimg_post_prompt`, `aimg_auto_generate_statuses`, `aimg_use_action_scheduler`, `aimg_kick_queue`, and REST endpoints `/featured`, `/status`, `/prompt` and `/templates/{id}/preview`.
* Enhance: The template list is loaded once per modal instead of on every tab switch, and the prompt box is disabled until an API key is set.
* Fix: Titles containing `&` or quotes are no longer shown as HTML codes in the Title text field, or drawn that way on images generated from the modal.
* Fix: The Settings page now confirms when your settings are saved.
* Update: **Current OpenAI models.** The Image Model setting now offers GPT Image 2.5 Flare (new default), GPT Image 2.5 Sunburst and GPT Image 2. OpenAI retired DALL·E 2 and DALL·E 3 on May 12, 2026 and shuts down GPT Image 1 on October 23, 2026, so those models are removed and sites using them switch to GPT Image 2.5 Flare automatically.
* Fix: Images can only be attached to posts you can edit, and automatic AI images are no longer queued when no API key is set ("AI image, template if AI fails" then uses the template right away).
* Fix: Publishing many posts at once with an AI method no longer starts a server process per post; the extra images are created in the background one after another.
* Fix: Images created in the background are now uploaded by the post's author, and an old failure message no longer shows on posts that have a featured image.
* Fix: Saving a post no longer retries a failed AI image on every save (each retry was a paid request); use **Try again** in the AI Featured Image panel instead.
* Fix: A finished background image now appears in the editor even while the AI Featured Image panel is collapsed.
* Fix: Users who can't upload files (such as Contributors) no longer see generate buttons that would only show a permission error, and the panel is hidden on post types without featured images.
* Fix: AI request timeouts now show a plain message instead of a technical error.

= 1.5.4 ( 6th October 2026 ) =
* New: **Who Can Generate AI Images** setting — allow AI images for Authors and above (default), Editors and above, or Administrators only. Template images stay available to everyone who can upload files.
* New: **Hourly Limit per User** setting for AI images (default 20, 0 for no limit) to keep API costs under control.
* New: Developer filters `aimg_can_generate_from_prompt`, `aimg_ai_hourly_limit` and `aimg_generate_timeout`.
* Enhance: The API key is no longer included in the settings page. The field now shows only the last 4 characters; leave it empty to keep your key, or use the new **Remove the saved API key** option.
* Enhance: AI image requests now wait up to 120 seconds, so slower GPT Image generations no longer time out.
* Enhance: Admin notices are now shown only to the user who triggered them.
* Fix: Long words in a title (such as URLs or product codes) no longer run off the edges of the image; the text shrinks or wraps to fit.
* Fix: Titles containing characters like `&`, quotes or apostrophes are now drawn correctly instead of as HTML codes, and used correctly as alt text.
* Fix: A missing GD/FreeType library or a damaged overlay image no longer causes a fatal error when saving a post.
* Fix: Deleting a template now also deletes its preview image.
* Fix: Template settings are now checked against the allowed values when saving.
* Fix: The template font size is now correctly labelled in points.

= 1.5.3 ( 5th October 2026 ) =
* Fix: Resolved a few minor issues.

= 1.5.0 ( 6th September 2026 ) =
* New: Added an optional **Remove Data on Uninstall** setting. When enabled, deleting the plugin also removes your image templates and settings; it is off by default, and images already in the Media Library are never touched.
* Enhance: Unified template rendering behind a single generator service, so automatic featured images, the block editor and the REST API all produce identical results.
* Fix: Template dimensions and title font size are now validated on save, preventing a malformed template from rendering a blank image.
* Fix: Resolved a few minor issues.

= 1.4.8 ( 21st August 2026 ) =
* Compatibility: Tested up to WordPress 7.1.

= 1.4.5 ( 20th July 2026 ) =
* Fix: Resolved a few minor issues.

= 1.4.3 ( 16th July 2026 ) =
* Fix: The model 'dall-e-3' does not exist error for new OpenAI accounts. Switched default model to GPT Image 1.
* New: Added new settings option to select the AI image model (GPT Image 1, GPT Image 1 Mini, DALL·E 2, DALL·E 3).

= 1.4.1 ( 14th July 2026 ) =
* Fix: Resolved a few minor issues.

= 1.4.0 ( 14th June 2026 ) =
* New: Added **image generation** in the Media Library via the "Generate Image" button, allowing users to create images without opening a post or page.
* New: Added updated plugin screenshots to the WordPress.org plugin page.
* Enhance: Improved template editor with live preview and better color contrast checks.
* Fix: Resolved a few minor issues.
* Compatibility: Tested up to WordPress 7.0.

= 1.3.0 ( 9th May 2026 ) =
* New: Full **block editor (Gutenberg) integration** — toolbar button on Image and Media & Text blocks, plus an AI Featured Image panel in the document sidebar.
* New: Generate images directly inside the editor from a saved template or a custom AI prompt.
* New: **AI image generation via OpenAI DALL·E 3** (configurable API key, swappable endpoint and model via filters).
* New: REST API endpoints (`aimg/v1/generate`, `aimg/v1/templates`) with capability and nonce checks for headless and automation use.
* New: `AIMG_API_KEY` PHP constant for storing the API key outside the database.
* Fix: Resolved minor bugs in the template image generation pipeline.
* Compatibility: Tested up to WordPress 6.9.

= 1.1.0 ( 3rd March 2026 ) =
* New: Unlimited image templates with custom styles, dimensions, and overlay images.
* Fix: Compatibility issues with the latest WordPress release.
* Enhance: Faster image generation with reduced server load.

= 1.0.0 ( 22nd December 2025 ) =
* Initial release.

== Upgrade Notice ==

= 1.8.0 =
Adds free stock photos from Unsplash, Pexels and Pixabay and photo templates. Older templates are converted to the Template Studio format in the background only when they look exactly the same. Removes aimg_generate_preview().

= 1.7.1 =
The classic template form is replaced by the Template Studio. Your templates and images are not changed.

= 1.7.0 =
Adds the visual Template Studio. Your existing templates and images are not changed; a template switches to the Studio format only when you save it in the Studio.

== Support and Feedback ==

Have questions, need help, or want to suggest a feature? We'd love to hear from you!
- **Plugin Support Forum:** [https://wordpress.org/support/plugin/artificial-image-generator](https://wordpress.org/support/plugin/artificial-image-generator)
- **Plugin Homepage:** [https://beautifulplugins.com/plugins/image-generator-pro/](https://beautifulplugins.com/plugins/image-generator-pro/)

== License ==
This plugin is released under the GPLv2 or later. See [https://www.gnu.org/licenses/gpl-2.0.html](https://www.gnu.org/licenses/gpl-2.0.html) for details.

**Thank you for using Image Generator!**
We're dedicated to helping you create visually stunning, SEO-optimized posts and pages with ease — powered by AI when you want it, and reliable image templates when you don't.
