www.bio-krby-kamna.cz Posted January 28, 2021 Share Posted January 28, 2021 (edited) Hi, i need options on Admin Product TAB for regenerate images only this one product. PS 1.6. Any solution? Thanks. Edited January 28, 2021 by www.bio-krby-kamna.cz (see edit history) Link to comment Share on other sites More sharing options...
Prestachamps Posted January 28, 2021 Share Posted January 28, 2021 Hi, I found this one which is probably close to what you're looking for. The module offers you the option to delete as well generate images on a product level! Hope it helps Link to comment Share on other sites More sharing options...
www.bio-krby-kamna.cz Posted January 28, 2021 Author Share Posted January 28, 2021 5 hours ago, ndiaga said: If you need to change images for only one product why not delete old images and upload new images again? because one product sometime have lot of image, its not real delete and upload again 5 hours ago, Prestachamps said: Hi, I found this one which is probably close to what you're looking for. The module offers you the option to delete as well generate images on a product level! Hope it helps Module not exist now :-) Developer now support only PS 1.7. If presta can regenerate all of image, maybe exist some simple command for regenerate only one product? Thanks for advice. Link to comment Share on other sites More sharing options...
Prestachamps Posted January 28, 2021 Share Posted January 28, 2021 I'm not sure about the developer, but when I checked everything was there Here is a Google cached version the page (just to tease him ;)) As you can see the modules was PS 1.6 ready Why did he deleted the post - frankly I don't care, and find a bit childish as it was recommended;) Link to comment Share on other sites More sharing options...
www.bio-krby-kamna.cz Posted January 28, 2021 Author Share Posted January 28, 2021 i contact him, not sussesful. Developer now work only with PS 1.7 😐 Link to comment Share on other sites More sharing options...
musicmaster Posted January 28, 2021 Share Posted January 28, 2021 You can do this with Prestools. It is free. Link to comment Share on other sites More sharing options...
www.bio-krby-kamna.cz Posted January 28, 2021 Author Share Posted January 28, 2021 (edited) Thanks a lot musicmaster. But script not work. When i try regenerate product image with any product id or regenerate image with any image id I got message p413Image 2091 dir not Found. Image 2092 dir not Found. Image 2093 dir not Found. Remove existing is disabled so some images may have been skipped. end i think script not work with classic image path system, only with new system with directory. i have classic image path system when all product image exist in only one directory p and have name as [product.id]-[image.id]-large(home.. etc.).jpg for ex. 413-2093-home.jpg without any subdirectory. Edited January 28, 2021 by www.bio-krby-kamna.cz (see edit history) Link to comment Share on other sites More sharing options...
www.bio-krby-kamna.cz Posted January 29, 2021 Author Share Posted January 29, 2021 (edited) on product-edit.php you have correct selection image directory { $legacy_images = get_configuration_value('PS_LEGACY_IMAGES'); $base_uri = get_base_uri(); } $imgsizing = 'style="width:'.$prod_imgwidth.'px; height:'.$prod_imgheight.'px;"'; $path = getpath($id_image); if($legacy_images) // right select !!! { $imgbase = $base_uri.'img/p/'.$id_product.'-'.$id_image; $imgdir = $base_uri.'img/p/'; $localbase = $localpath.'/img/p/'.$id_product.'-'.$id_image; $localdir = $localpath.'/img/p/'; $namebase = $id_product.'-'.$id_image; } else { $imgbase = $base_uri.'img/p'.$path.'/'.$id_image; $imgdir = $base_uri.'img/p'.$path.'/'; $localbase = $localpath.'/img/p'.$path.'/'.$id_image; $localdir = $localpath.'/img/p'.$path.'/'; $namebase = $id_image; } on the other php section, script work only with one image file system without support Legacy Edited January 29, 2021 by www.bio-krby-kamna.cz (see edit history) Link to comment Share on other sites More sharing options...
www.bio-krby-kamna.cz Posted February 1, 2021 Author Share Posted February 1, 2021 Any idea? Link to comment Share on other sites More sharing options...
jorge2800 Posted November 2, 2023 Share Posted November 2, 2023 (edited) 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); } } } } ?> Edited November 2, 2023 by jorge2800 (see edit history) 1 Link to comment Share on other sites More sharing options...
QuickUpdate.net Posted November 2, 2023 Share Posted November 2, 2023 (edited) We have included this functionality in our Prestashop suite QuicKupdate - eg you are able to regenerate images for any number of products down to the product level. Additionally if you have a large number of products you will have a very speedy regeneration and not get a time out because the app does batch processing of the products you want to regenerate. Attached how it looks: Edited November 2, 2023 by QuickUpdate.net (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now