PrestaShop Module
Generate AI product images, remove backgrounds, and bulk-process your PrestaShop catalog with the FOTOhub AI module.
Installation
- Download the module from GitHub
- Go to Modules → Module Manager in PrestaShop back office
- Click Upload a Module and select the zip file
- Click Configure after installation
Or via command line:
bash
cd /var/www/prestashop/modules/
unzip fotohubai.zip
php bin/console prestashop:module install fotohubaiConfiguration
After installation, go to Modules → FOTOhub AI → Configure:
| Setting | Description |
|---|---|
| API Key | Your FOTOhub API key (fh_live_...) |
| Default Model | Image generation model (default: seedream-5-0-260128) |
| Image Width | Default width for generated images |
| Image Height | Default height for generated images |
Click Test Connection to verify your API key works.
Features
Product Image Generation
Generate AI images directly from the product edit page:
- Edit any product in Catalog → Products
- Go to the Images tab
- Click "Generate with FOTOhub AI" button
- The module auto-creates a prompt from product name, category, and features
- Choose style and number of images
- Generated images are added to the product gallery
Bulk Catalog Processing
Process multiple products at once:
- Go to Catalog → FOTOhub Bulk (added by the module)
- Filter products by category, manufacturer, or missing images
- Select action:
- Generate — Create new product photos
- Remove Background — Process existing product images
- Upscale — Enhance low-resolution images
- Click Start Processing
- Progress bar shows real-time status
Background Removal
Remove backgrounds from product images:
- Edit product → Images tab
- Select an existing image
- Click "Remove Background"
- Transparent PNG is saved as a new product image
Image Upscaling
Upscale low-resolution product images:
- Edit product → Images tab
- Select image to upscale
- Click "Upscale (2x/4x)"
- High-resolution version replaces the original
Admin Controller
The module adds a dedicated admin page at Catalog → FOTOhub Bulk with:
- Product list with image status indicators
- Batch selection (checkbox per product)
- Action selector (generate / remove-bg / upscale)
- Queue progress with thumbnails
- Credit balance display
- Generation history log
Hooks
The module uses PrestaShop hooks for seamless integration:
| Hook | Purpose |
|---|---|
displayAdminProductsExtra | Adds "Generate with AI" button on product page |
actionAdminProductsControllerSaveAfter | Optional auto-generation on product save |
displayBackOfficeHeader | Loads admin CSS/JS assets |
Smarty Variables
In custom templates, access FOTOhub data:
smarty
{* Check if FOTOhub is configured *}
{if $fotohub_configured}
<p>Credits remaining: {$fotohub_credits}</p>
<p>Plan: {$fotohub_plan}</p>
{/if}API Client
The module includes FotoHubApiClient class for custom development:
php
// In a custom PrestaShop controller or module
require_once _PS_MODULE_DIR_ . 'fotohubai/classes/FotoHubApiClient.php';
$client = new FotoHubApiClient(
Configuration::get('FOTOHUBAI_API_KEY')
);
// Generate an image
$result = $client->generateImage(
'Professional product photo: ' . $product->name,
['model' => 'seedream-5-0-260128', 'width' => 1024, 'height' => 1024]
);
// Remove background
$result = $client->removeBackground($imageUrl);
// Check balance
$balance = $client->getBalance();Multi-language Support
The module respects PrestaShop's multi-language system:
- Prompts are built from the active back-office language
- Generated images are assigned to all languages (shared images)
- Admin interface is translatable
Requirements
- PrestaShop 8.0+
- PHP 8.0+
- cURL extension enabled
- Active FOTOhub account with API key
Troubleshooting
| Issue | Solution |
|---|---|
| "Connection failed" | Check API key in module configuration |
| "Insufficient credits" | Top up at fotohub.app/console |
| Images not saving | Check img/p/ directory permissions (755) |
| Module not appearing | Clear PrestaShop cache: Advanced Parameters → Performance |
| Timeout on bulk | Reduce batch size or increase PHP max_execution_time |

