-
Notifications
You must be signed in to change notification settings - Fork 45
Description
Feature Overview & Value
Summary:
This feature allows users to generate images directly from text prompts within the WordPress editor. Users can either generate a featured image for the post or insert an image directly into the post body using the image block. The goal is to simplify the process of sourcing relevant visuals and to help users enhance posts or pages without leaving the editor.
Why it matters:
Sourcing or designing relevant images slows down the publishing process, especially for non-designers. This feature reduces that friction by offering a quick, integrated way to create visuals from simple prompts—saving time and encouraging stronger visual engagement. It supports both functional needs (e.g., adding a featured image) and creative expression.
Use Cases:
- A user wants to generate a featured image based on the post’s topic
- An author wants a visual to break up text or complement a paragraph
- A marketer needs a simple graphic to match a post without switching tools
Assumptions:
- The Excerpt Generation feature is already in place and available
- The AI Services plugin handles model authentication and API requests
Featured Image Flow
Entry Point:
- In the Featured Image panel, a "Generate with AI" button appears when no image is set.
Prompt Handling:
- When clicked, the system automatically uses the post excerpt (generated by the Excerpt Generation feature) as the prompt.
- No manual prompt entry is required in this flow.
Context Strategy:
- The excerpt is passed as background context to the image model.
- If for some reason the excerpt is missing, a truncated section of post content (~150–200 words) may be used instead.
- Alternatively, instead of using a truncated version instead we could send the entire content. We could daisy chain this, where we first send the content, have AI summarize it and then use that summary to generate the image. It may be worth some testing once we get to this point to see what gives us the best result, whether the full content works better or if the summary works just as well.
Generation & Output:
- A loading indicator shows generation is in progress.
- Once complete, the user sees a preview with options to:
- Set the image as the featured image
- Regenerate
- Cancel
Media Handling:
- The image is saved automatically to the Media Library.
- A filename is generated using the post slug or prompt. Prompts can get long and cause issues when used as file names, so we'll want to ensure we truncate this to a certain length.
- Alternatively to using the prompt in the filename, the full prompt could be added into the alt text field and perhaps a summary of the prompt is used for the image title.
- (Optional) An AI-generated tag may be added for transparency.
Editorial Considerations:
- Intent: Provide a general-purpose visual that summarizes the tone or subject of the full post.
- Control: No prompt writing or fine-tuning; users can only regenerate or accept.
- Risk: Low, since the input is excerpt-based and system-defined.
- Tone: Neutral, context-aware, and broadly illustrative.
Inline Image Block Flow
Entry Point:
- When adding an image block, users see a "Generate with AI" option alongside the existing media options.
Prompt Handling:
- Users enter a freeform description of the image they want.
- (Optional future enhancement) The system may suggest a starter prompt based on nearby paragraph content.
Context Strategy:
- The user’s prompt is primary.
- We may include block-level context in the background in future versions to improve image relevance.
Generation & Output:
- A loading state appears while the image is being created.
- The user sees a preview with options to:
- Insert into the post
- Regenerate
- Cancel
Media Handling:
- The image is added to the Media Library automatically.
- The filename is based on the user’s prompt or a unique slug.
Technical Requirements
Model Integration:
- Connects to the image generation provider via the AI Services plugin (OpenAI, Stability, or self-hosted models)
- Prompts and responses handled through standardized API call structure
Input Handling:
- Featured Image flow uses the post excerpt (or fallback text snippet) as prompt
- Inline flow accepts freeform user input
- Optional: allow prompt templating or dynamic parameter injection in future
Output Handling:
- Returned image is previewed in the UI before final placement
- User must confirm insertion or featured image application
- Image is saved to the Media Library with a generated filename and metadata
Storage & Metadata:
- Images saved to the site’s uploads directory and indexed in WordPress Media Library
- Include metadata field (e.g.,
_ai_generated = true) to optionally identify AI-generated assets - Include a
captionthat automatically attributes the source of the generated image to the AI service provider utilized. OpenAI already provides that (and perhaps wants AI clients to do that as well) though not sure if that should be a requirement for this plugin or not.
Error & Timeout Handling:
- Gracefully handle timeouts, API failures, or unsupported prompt content
- UI displays fallback message with retry option
Security & Privacy:
- No excerpt or prompt data is stored externally
- API keys are stored and managed via AI Services plugin
- Generated images do not expose post content unless explicitly included in the prompt
Extensibility Notes:
- System should allow hooks for other plugins to filter prompts, override image size, or customize file naming
- Allow for future UI expansion (e.g., style selector, aspect ratio presets)
Design mockups
Version 1 - Featured Image Generation
Version 1 - Post Image Generation
Version 2 - Featured and Post Image Generation
Props to Lina Wiezkowiak for the product definition, Rachael Cortellessa for the designs, and Darin Kotter for technical review of both.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status