Hi,
here is a solution to generate images for one product only, it use also watermark module:
<?php // Include PrestaShop's configuration file require_once(dirname(__FILE__).'/config/config.inc.php'); require_once(dirname(__FILE__).'/init.php'); // Set the product ID for which to regenerate thumbnails $productId = YOUR_PRODUCT_ID; // Replace YOUR_PRODUCT_ID with the actual product ID // Load the product $product = new Product((int)$productId); // Load the product's images $images = $product->getImages((int)Configuration::get('PS_LANG_DEFAULT')); // Regenerate thumbnails for each image of the product foreach ($images as $image) { // Create new Image object $imageObj = new Image((int)$image['id_image']); // Define the types of images to regenerate (you can modify this array with the types you want) $imageTypes = ImageType::getImagesTypes('products'); // Regenerate thumbnails for each image type foreach ($imageTypes as $imageType) { $newImagePath = _PS_PROD_IMG_DIR_.$imageObj->getExistingImgPath().'-'.$imageType['name'].'.'.$imageObj->image_format; // Resize image if (!ImageManager::resize( _PS_PROD_IMG_DIR_.$imageObj->getExistingImgPath().'.'.$imageObj->image_format, $newImagePath, (int)$imageType['width'], (int)$imageType['height'] )) { // Handle errors echo 'Error regenerating thumbnail for image ID ' . $image['id_image'] . ' for type ' . $imageType['name']; continue; } // Apply watermark if the module is installed and enabled $watermarkModule = Module::getInstanceByName('watermark'); if ($watermarkModule && $watermarkModule->active) { // Check if the method 'hookActionWatermark' exists in the watermark module if (method_exists($watermarkModule, 'hookActionWatermark')) { // Prepare the hook arguments $hookArgs = array( 'image_type' => $imageType['name'], 'id_image' => $imageObj->id, 'id_product' => $product->id ); // Call the watermark hook $watermarkModule->hookActionWatermark($hookArgs); } } } } ?>