diff --git a/includes/core/class-image-pipeline.php b/includes/core/class-image-pipeline.php index 02e1348..7dafb7b 100644 --- a/includes/core/class-image-pipeline.php +++ b/includes/core/class-image-pipeline.php @@ -27,8 +27,10 @@ class PRAutoBlogger_Image_Pipeline { /** * Default image dimensions (landscape). */ + // FLUX.1 requires both dimensions to be divisible by 8. + // 1200×632 is the closest 8-aligned pair to the standard OG image size (1200×630). private const DEFAULT_WIDTH = 1200; - private const DEFAULT_HEIGHT = 630; + private const DEFAULT_HEIGHT = 632; /** * The image provider (FLUX.1 via Cloudflare or another). diff --git a/includes/providers/class-cloudflare-image-provider.php b/includes/providers/class-cloudflare-image-provider.php index 734dead..9554965 100644 --- a/includes/providers/class-cloudflare-image-provider.php +++ b/includes/providers/class-cloudflare-image-provider.php @@ -69,6 +69,10 @@ class PRAutoBlogger_Cloudflare_Image_Provider implements PRAutoBlogger_Image_Pro * @throws \RuntimeException On auth failure, bad response shape, or retry exhaustion. */ public function generate_image( string $prompt, int $width, int $height, array $options = [] ): array { + // FLUX.1 requires dimensions divisible by 8; round to nearest valid value. + $width = (int) ( round( $width / 8 ) * 8 ); + $height = (int) ( round( $height / 8 ) * 8 ); + $this->assert_valid_dimensions( $width, $height ); $prompt = trim( $prompt ); if ( '' === $prompt ) {