feat: switch to single-panel newspaper comic style for article images
Replace photography-style prompts with a comedy writer system prompt that generates Far Side-style single-panel comic concepts with punchy captions. The LLM rewriter now outputs a comic scene + caption line, and the style suffix renders as classic black-ink newspaper comic on yellowed newsprint. Includes v3 style migration to auto-replace both the old infomercial and the short-lived photography style in wp_options. Bumped max_tokens to 180 to accommodate scene + caption output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -123,17 +123,26 @@ class PRAutoBlogger {
|
||||
update_option( 'prautoblogger_migrated_gemini_flash_lite', '1' );
|
||||
}
|
||||
|
||||
// One-time migration: replace 90s infomercial style suffix with premium
|
||||
// science editorial style. The old pastiche rendered poorly on Gemini/GPT-5
|
||||
// Image models. Only overwrite if the stored value IS the old default — if
|
||||
// the user customized it, respect their choice.
|
||||
if ( ! get_option( 'prautoblogger_migrated_style_suffix_v2' ) ) {
|
||||
$old_infomercial = 'Style: a screengrab from a 1995 late-night cable TV infomercial';
|
||||
$current = get_option( 'prautoblogger_image_style_suffix', '' );
|
||||
if ( '' === $current || false !== strpos( $current, $old_infomercial ) ) {
|
||||
// One-time migration (v3): switch to single-panel newspaper comic style.
|
||||
// Replaces both the old infomercial pastiche and the short-lived premium
|
||||
// photography style. Force-update unless the user has a truly custom value.
|
||||
if ( ! get_option( 'prautoblogger_migrated_style_suffix_v3' ) ) {
|
||||
$known_old_prefixes = [
|
||||
'Style: a screengrab from a 1995', // v1: infomercial.
|
||||
'Style: premium scientific lifestyle', // v2: photography.
|
||||
];
|
||||
$current = get_option( 'prautoblogger_image_style_suffix', '' );
|
||||
$is_old = ( '' === $current );
|
||||
foreach ( $known_old_prefixes as $prefix ) {
|
||||
if ( false !== strpos( $current, $prefix ) ) {
|
||||
$is_old = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( $is_old ) {
|
||||
update_option( 'prautoblogger_image_style_suffix', PRAUTOBLOGGER_DEFAULT_IMAGE_STYLE_SUFFIX );
|
||||
}
|
||||
update_option( 'prautoblogger_migrated_style_suffix_v2', '1' );
|
||||
update_option( 'prautoblogger_migrated_style_suffix_v3', '1' );
|
||||
}
|
||||
|
||||
// One-time migration: re-wrap existing encrypted values with "enc:" prefix.
|
||||
|
||||
@@ -28,28 +28,33 @@ class PRAutoBlogger_Image_Prompt_Builder {
|
||||
* code review, not an admin-panel click.
|
||||
*/
|
||||
private const REWRITER_SYSTEM_PROMPT = <<<'PROMPT'
|
||||
You are an image-prompt specialist for premium AI image models (Gemini Flash Image, GPT-5 Image).
|
||||
You are a comedy writer and single-panel cartoon creator, like Gary Larson (The Far Side) meets science humor.
|
||||
|
||||
Given an article title and summary about peptides, supplements, or biohacking, write ONE vivid scene description (2-3 sentences, under 80 words) for a compelling featured image. Emphasize:
|
||||
- OBJECTS and MATERIALS: lab glassware, peptide vials, molecular structures, syringes, supplement bottles, biometric devices, microscopes, fitness equipment, test tubes
|
||||
- LIGHTING and DEPTH: bright directional studio lighting, selective focus, rich warm/cool color contrasts
|
||||
- COMPOSITION: dynamic framing with clear focal point, professional product photography perspective, sense of scale and precision
|
||||
- MOOD: scientific credibility paired with aspirational wellness — premium feel, approachable, engaging
|
||||
Given an article title and summary about peptides, supplements, or biohacking, create a SINGLE-PANEL COMIC concept. Output TWO parts separated by a blank line:
|
||||
|
||||
Avoid:
|
||||
- Abstract concepts; show concrete objects only
|
||||
- Text, logos, watermarks, or readable labels
|
||||
- Detailed human faces (use hands, torso, silhouettes, or exclude people)
|
||||
- Multiple competing visual elements; keep the subject dominant
|
||||
- Generic stock-photo composition
|
||||
SCENE: One sentence describing the visual gag — a funny, absurd, or ironic situation related to the article's topic. Use anthropomorphized molecules, lab-coat-wearing animals, befuddled scientists, gym bros encountering peptide science, supplement bottles with personality, or everyday situations with a peptide twist. Keep it simple — one clear visual joke, 1-3 characters max.
|
||||
|
||||
Output ONLY the scene description — no preamble, explanation, or quotes. Do NOT include any style direction; that is appended separately.
|
||||
CAPTION: A short, punchy caption or speech bubble line (under 15 words) that delivers the punchline. The humor should be dry, nerdy, and accessible — the reader should chuckle even if they only half-understand the science.
|
||||
|
||||
Rules:
|
||||
- The joke MUST relate to the article's actual subject matter, not generic science humor
|
||||
- Characters can have simple cartoon faces (round heads, dot eyes, expressive eyebrows)
|
||||
- Keep the scene physically simple — few objects, clear staging, easy to read at thumbnail size
|
||||
- The caption should work as a standalone joke even without the image
|
||||
- No logos, watermarks, or branding
|
||||
- Output ONLY the scene and caption. No preamble, no explanation.
|
||||
|
||||
Example output format:
|
||||
A muscular gym bro stares in confusion at a tiny vial while a peptide molecule with arms and legs flexes next to him, clearly outperforming him.
|
||||
|
||||
"I've been doing this wrong for three years."
|
||||
PROMPT;
|
||||
|
||||
/**
|
||||
* Max tokens for the rewriter response. Scene descriptions are short.
|
||||
* Max tokens for the rewriter response. Comic concepts need more room
|
||||
* for the scene description plus the caption punchline.
|
||||
*/
|
||||
private const REWRITER_MAX_TOKENS = 120;
|
||||
private const REWRITER_MAX_TOKENS = 180;
|
||||
|
||||
/**
|
||||
* OpenRouter provider for LLM calls. Null until first use.
|
||||
@@ -220,15 +225,11 @@ PROMPT;
|
||||
* @return string Synthesized visual prompt concept.
|
||||
*/
|
||||
private function synthesize_visual_concepts_fallback( string $title, string $supporting_text ): string {
|
||||
$prompt = "A visual representation of: {$title}";
|
||||
|
||||
if ( '' !== $supporting_text ) {
|
||||
$snippet = strlen( $supporting_text ) > 150
|
||||
? substr( $supporting_text, 0, 150 ) . '...'
|
||||
: $supporting_text;
|
||||
|
||||
$prompt .= ". Context: {$snippet}";
|
||||
}
|
||||
// Fallback produces a simple comic concept when the LLM is unavailable.
|
||||
$prompt = sprintf(
|
||||
'A cartoon scientist in a lab coat looking bewildered while examining something related to: %s. Caption below reads: "Science is full of surprises."',
|
||||
$title
|
||||
);
|
||||
|
||||
return trim( $prompt );
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ declare(strict_types=1);
|
||||
* Plugin Name: PRAutoBlogger
|
||||
* Plugin URI: https://peptiderepo.com/prautoblogger
|
||||
* Description: Monitors social media for trending topics, generates SEO-friendly blog posts using AI, and publishes them on a daily schedule with full cost tracking and self-improvement metrics.
|
||||
* Version: 0.2.8
|
||||
* Version: 0.2.9
|
||||
* Requires at least: 6.0
|
||||
* Requires PHP: 7.4
|
||||
* Author: PeptideRepo
|
||||
@@ -35,7 +35,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
| and limits without magic strings.
|
||||
*/
|
||||
|
||||
define( 'PRAUTOBLOGGER_VERSION', '0.2.8' );
|
||||
define( 'PRAUTOBLOGGER_VERSION', '0.2.9' );
|
||||
define( 'PRAUTOBLOGGER_DB_VERSION', '1.1.0' );
|
||||
define( 'PRAUTOBLOGGER_PLUGIN_FILE', __FILE__ );
|
||||
define( 'PRAUTOBLOGGER_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||
@@ -59,14 +59,12 @@ define( 'PRAUTOBLOGGER_DEFAULT_EDITOR_MODEL', 'google/gemini-2.5-flash-lite' );
|
||||
define( 'PRAUTOBLOGGER_DEFAULT_IMAGE_PROVIDER', 'openrouter' );
|
||||
define( 'PRAUTOBLOGGER_DEFAULT_IMAGE_MODEL', 'google/gemini-2.5-flash-image' );
|
||||
|
||||
// Default style suffix appended to every image-gen prompt to create a
|
||||
// cohesive visual brand across all article images. Updated 2026-04-18
|
||||
// after switching from FLUX.1 to Gemini/GPT-5 Image models — the old
|
||||
// 90s infomercial pastiche rendered poorly on the new models. Users may
|
||||
// override via Settings → Images → Style Suffix.
|
||||
// Default style suffix appended to every image-gen prompt. Updated
|
||||
// 2026-04-18: single-panel newspaper comic style. Users may override
|
||||
// via Settings → Images → Style Suffix.
|
||||
define(
|
||||
'PRAUTOBLOGGER_DEFAULT_IMAGE_STYLE_SUFFIX',
|
||||
'Style: premium scientific lifestyle photography, professional laboratory setting with warm studio lighting, shallow depth of field, color-graded for wellness branding in rich golds and deep teals, high-end editorial quality.'
|
||||
'Style: a single-panel newspaper comic in classic black ink on white paper, simple clean linework like The Far Side or B.C., slightly yellowed newsprint texture, hand-drawn crosshatching for shading, bold panel border, caption text in a clean sans-serif font below the panel, warm and humorous tone, visible in a newspaper comics section.'
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user