From 10e36ea7895296ec909fff4aff0875424071e734 Mon Sep 17 00:00:00 2001
From: faisal-alvi
Date: Fri, 21 Feb 2025 20:00:14 +0530
Subject: [PATCH 01/27] add `get_image_quality_options()`
---
includes/Classifai/Providers/OpenAI/DallE.php | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/includes/Classifai/Providers/OpenAI/DallE.php b/includes/Classifai/Providers/OpenAI/DallE.php
index aaf3d63de..dcd417254 100644
--- a/includes/Classifai/Providers/OpenAI/DallE.php
+++ b/includes/Classifai/Providers/OpenAI/DallE.php
@@ -110,10 +110,7 @@ public function render_provider_fields() {
[
'option_index' => static::ID,
'label_for' => 'quality',
- 'options' => [
- 'standard' => __( 'Standard', 'classifai' ),
- 'hd' => __( 'High Definition', 'classifai' ),
- ],
+ 'options' => self::get_image_quality_options(),
'default_value' => $settings['quality'],
'description' => __( 'The quality of the image that will be generated. High Definition creates images with finer details and greater consistency across the image but costs more.', 'classifai' ),
'class' => 'classifai-provider-field hidden provider-scope-' . static::ID,
@@ -160,6 +157,18 @@ public function render_provider_fields() {
);
}
+ /**
+ * Returns the quality options for the provider.
+ *
+ * @return array
+ */
+ public static function get_image_quality_options() {
+ return array(
+ 'standard' => __( 'Standard', 'classifai' ),
+ 'hd' => __( 'High Definition', 'classifai' ),
+ );
+ }
+
/**
* Returns the default settings for the provider.
*
From d3efe1199ae079851c105bea80ccbd50a869b89f Mon Sep 17 00:00:00 2001
From: faisal-alvi
Date: Fri, 21 Feb 2025 20:00:43 +0530
Subject: [PATCH 02/27] add `get_image_size_options()`
---
includes/Classifai/Providers/OpenAI/DallE.php | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/includes/Classifai/Providers/OpenAI/DallE.php b/includes/Classifai/Providers/OpenAI/DallE.php
index dcd417254..e5c5b8611 100644
--- a/includes/Classifai/Providers/OpenAI/DallE.php
+++ b/includes/Classifai/Providers/OpenAI/DallE.php
@@ -126,11 +126,7 @@ public function render_provider_fields() {
[
'option_index' => static::ID,
'label_for' => 'image_size',
- 'options' => [
- '1024x1024' => '1024x1024 (square)',
- '1792x1024' => '1792x1024 (landscape)',
- '1024x1792' => '1024x1792 (portrait)',
- ],
+ 'options' => self::get_image_size_options(),
'default_value' => $settings['image_size'],
'description' => __( 'Size of generated images. Larger sizes cost more.', 'classifai' ),
'class' => 'classifai-provider-field hidden provider-scope-' . static::ID,
@@ -169,6 +165,19 @@ public static function get_image_quality_options() {
);
}
+ /**
+ * Returns the image size options for the provider.
+ *
+ * @return array
+ */
+ public static function get_image_size_options() {
+ return array(
+ '1024x1024' => '1024x1024 (square)',
+ '1792x1024' => '1792x1024 (landscape)',
+ '1024x1792' => '1024x1792 (portrait)',
+ );
+ }
+
/**
* Returns the default settings for the provider.
*
From 15831d7e41f91a285330d557ee1c167bdd031ffb Mon Sep 17 00:00:00 2001
From: faisal-alvi
Date: Fri, 21 Feb 2025 20:01:03 +0530
Subject: [PATCH 03/27] add `get_image_style_options()`
---
includes/Classifai/Providers/OpenAI/DallE.php | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/includes/Classifai/Providers/OpenAI/DallE.php b/includes/Classifai/Providers/OpenAI/DallE.php
index e5c5b8611..8198b8155 100644
--- a/includes/Classifai/Providers/OpenAI/DallE.php
+++ b/includes/Classifai/Providers/OpenAI/DallE.php
@@ -142,10 +142,7 @@ public function render_provider_fields() {
[
'option_index' => static::ID,
'label_for' => 'style',
- 'options' => [
- 'vivid' => __( 'Vivid', 'classifai' ),
- 'natural' => __( 'Natural', 'classifai' ),
- ],
+ 'options' => self::get_image_style_options(),
'default_value' => $settings['style'],
'description' => __( 'The style of the generated images. Vivid causes more hyper-real and dramatic images. Natural causes more natural, less hyper-real looking images.', 'classifai' ),
'class' => 'classifai-provider-field hidden provider-scope-' . static::ID,
@@ -178,6 +175,18 @@ public static function get_image_size_options() {
);
}
+ /**
+ * Returns the style options for the provider.
+ *
+ * @return array
+ */
+ public static function get_image_style_options() {
+ return array(
+ 'vivid' => __( 'Vivid', 'classifai' ),
+ 'natural' => __( 'Natural', 'classifai' ),
+ );
+ }
+
/**
* Returns the default settings for the provider.
*
From ae45710f902e20b2399e3273d40247443ab59cd6 Mon Sep 17 00:00:00 2001
From: faisal-alvi
Date: Fri, 21 Feb 2025 20:01:34 +0530
Subject: [PATCH 04/27] add HTML markup
---
.../Classifai/Features/ImageGeneration.php | 47 +++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/includes/Classifai/Features/ImageGeneration.php b/includes/Classifai/Features/ImageGeneration.php
index 3f7e67c86..26c94e7bc 100644
--- a/includes/Classifai/Features/ImageGeneration.php
+++ b/includes/Classifai/Features/ImageGeneration.php
@@ -299,6 +299,53 @@ public function print_media_templates() {
?>
+
+
+
+
+
+
+
+
+
+
+