elgentos / magento2-ai-category-hero-images
Generate AI-powered hero images for categories using OpenAI
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 2
Open Issues: 0
Type:magento2-module
Requires
- php: ~8.1.0||~8.2.0||~8.3.0||~8.4.0
- magento/framework: *
- openai-php/client: *
This package is auto-updated.
Last update: 2025-04-25 18:47:59 UTC
README
This Magento 2 extension generates AI-powered hero images for categories using OpenAI's GPT-Image-1 model.
Features
- Button "Generate with AI" in the admin when on the Category edit page
- Console command to generate AI hero images in bulk for categories
- Selects random products from a category and uses their information to generate a prompt
- Enhances the prompt based on product information
- Uses OpenAI's GPT-Image-1 model to create a visually appealing hero image
- Automatically sets the generated image as the category image
- Configurable through the Magento admin panel
Requirements
- Magento 2.4.x
- PHP 8.1 or higher
- OpenAI API key
- A verified organization (after verification it takes about 30 minutes for existing keys to reflect the change)
Installation
Composer Installation
composer require elgentos/magento2-ai-category-hero-images
- Run the following commands:
bin/magento module:enable Elgentos_AiCategoryHeroImages bin/magento setup:upgrade
Configuration
- Go to Stores > Configuration > Elgentos > AI Category Hero Images
- Enable the module
- Enter your OpenAI API key
- (Optional) Enter your OpenAI Organization ID if you have one
Usage
Open a category and click the "Generate with AI" button, followed by optionally adapting the prompt to your liking.
Or run the following command to generate a hero image for a category:
bin/magento elgentos:aicategoryhero:generate [category_id]
Options:
--num-products
or-p
: Number of products to include in the image (default: 3)
Example:
bin/magento elgentos:aicategoryhero:generate 4 --num-products=5
How It Works
- The extension selects random products from the specified category
- It generates a prompt based on the category name and product information
- The enhanced prompt is sent to OpenAI's GPT-Image-1 model using a direct cURL request
- The generated image is saved to the Magento media directory
- The image is set as the category image