Union types (array|WP_Error, int|WP_Error, string|WP_Error) require
PHP 8.0+. Removed return type declarations while keeping @return
docblocks intact for IDE/static analysis support.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Completes the image + A/B experiment workstream by integrating
image generation into the post publishing pipeline.
New classes:
- class-image-pipeline.php: Orchestrates A/B generation (article-driven
Image A → featured; source-driven Image B → post meta). Each image
independently fallible; article publishes even if both fail.
- class-image-prompt-builder.php: Synthesizes visual prompts from article
title+content and Reddit source data. Appends CEO-locked 90s infomercial
style suffix. Keeps prompts concise for FLUX.1 quality.
- class-image-media-sideloader.php: Downloads image bytes, creates temp
file, sideloads via media_handle_sideload(), sets alt text and metadata,
cleans up temp files.
Changes to existing files:
- Publisher.attach_generated_images(): Runs image pipeline post-creation,
sets _thumbnail_id (Image A) and _prautoblogger_image_b_id (Image B).
Errors logged but don't block post publication.
- Settings: prautoblogger_image_enabled (toggle, default off).
Tests:
- ImagePipelineTest.php: Orchestration, cost tracking, graceful failures.
- ImagePromptBuilderTest.php: Prompt generation, length limits.
Docs:
- ARCHITECTURE.md: New step 6b in data flow, new files in file tree.
- CHANGELOG.md: Commit 1a/1b breakdown.
Co-authored-by: peptiderepo <peptiderepo@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>