Digital360Europe Posted April 16, 2020 Share Posted April 16, 2020 I am a newbie to Prestashop and I would like your help. 😕 On the site where I develop Prestashop 1.7.6.2, I have used a Module that compressed all the photos of the products to provide better loading time. Unforulnaly the result is very bad and the images are pixelated. I wonder if there is a way to restore the product's images to their original resolution. I have checked from my FTP and the original photos exist.🙏 Link to comment Share on other sites More sharing options...
Digital360Europe Posted April 17, 2020 Author Share Posted April 17, 2020 I am a newbie to Prestashop and I need your help. 😕 even if my question seems silly!!! 😒 On the site where I am customizing, Prestashop 1.7.6.2, I have used a Module that compressed all the photos of the products to provide better loading time. Unfortunaly the result is very bad and the images are pixelated. I wonder if there is a way to restore the product's images to their original resolution. I have checked from my FTP and the original photos exist.🙏 Link to comment Share on other sites More sharing options...
jetway Posted April 17, 2020 Share Posted April 17, 2020 did you clear the cache after resizing? That might be a reason for pixelated images. However, if you have the originals you can go into images and let prestashop redo your images. Link to comment Share on other sites More sharing options...
Digital360Europe Posted April 17, 2020 Author Share Posted April 17, 2020 Thank you very much for your help.☺️ Do I have to regenarate all images and select to delete previous? I am afraid loosing them because I have done a lot of work with 5000 products... Link to comment Share on other sites More sharing options...
idnovate.com Posted April 17, 2020 Share Posted April 17, 2020 Regenerate images and remove the previous ones: Link to comment Share on other sites More sharing options...
joseantgv Posted April 17, 2020 Share Posted April 17, 2020 Don't duplicate threads!! Link to comment Share on other sites More sharing options...
Digital360Europe Posted April 17, 2020 Author Share Posted April 17, 2020 Thank you so much. I will do it and I 'll let you know😚 Link to comment Share on other sites More sharing options...
Digital360Europe Posted April 17, 2020 Author Share Posted April 17, 2020 Sorry I thought that I was into wrong category! Link to comment Share on other sites More sharing options...
ecommerce16 Posted April 17, 2020 Share Posted April 17, 2020 i compared the 2 posts Link to comment Share on other sites More sharing options...
Guest Posted April 17, 2020 Share Posted April 17, 2020 If you have chosen a webp format compression format, they will still remain on FTP. You won't be able to regenerate 5000 images with Prestashop. You will be hit with an expiration error of max_execution_time. Link to comment Share on other sites More sharing options...
Digital360Europe Posted April 17, 2020 Author Share Posted April 17, 2020 Yes, the format was webp. And now I try to regenerate product images but not all together at once. First I have tried the "large_default"but no luck. I have the same resolution and I don't know what to do.... Link to comment Share on other sites More sharing options...
Guest Posted April 17, 2020 Share Posted April 17, 2020 (edited) Here is a script that removes all webp images and all thumbnail images. Does not delete the original image. If the script finishes with an error (time runs out), no matter, you can run it again. Checks if there is an image, if any, deletes it, otherwise it continues. Save the script as eg delete-image.php Save this script to the Prestashop main directory. If you just want to test the script, just 3x comment on unlink. //unlink($imag.... I recommend backing up the ./img/p folder !!! <?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.inc.php'); include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'settings.inc.php'); $images_path = ''; $get_images = Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'image ORDER BY id_product ASC;'); $get_images_type = Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'image_type ORDER BY id_image_type ASC;'); foreach ($get_images as $get_image) { $image = new Image($get_image['id_image']); $image_webp_url = _PS_ROOT_DIR_.'/img/p/'.$image->getExistingImgPath().".webp"; $images_path .= $image_webp_url."\r\n"; if (file_exists($images_path)) { unlink($images_path); echo 'deleted image: '.$images_path.'<br />'; } foreach ($get_images_type as $get_image_type) { $image_jpg_url = _PS_ROOT_DIR_.'/img/p/'.$image->getExistingImgPath().'-'.$get_image_type['name'].".jpg"; if (file_exists($image_jpg_url)) { unlink($image_jpg_url); echo 'deleted image: '.$image_jpg_url.'<br />'; } $image_webp_url = _PS_ROOT_DIR_.'/img/p/'.$image->getExistingImgPath().'-'.$get_image_type['name'].".webp"; if (file_exists($image_webp_url)) { unlink($image_webp_url); echo 'deleted image: '.$image_webp_url.'<br />'; } } } echo 'Done'; Then just write a script that regenerates the images. But I will not write here anymore. It's laborious. Edited April 17, 2020 by Guest (see edit history) Link to comment Share on other sites More sharing options...
Digital360Europe Posted April 17, 2020 Author Share Posted April 17, 2020 Ok. I will try and I' ll you kwow! Thank you! Link to comment Share on other sites More sharing options...
Guest Posted April 17, 2020 Share Posted April 17, 2020 Thank you is a gray heart under the posts 🙂 I'll wait for the answer. Link to comment Share on other sites More sharing options...
Guest Posted April 18, 2020 Share Posted April 18, 2020 I am finishing up a module that will run without restriction timeout. Link to comment Share on other sites More sharing options...
Digital360Europe Posted April 18, 2020 Author Share Posted April 18, 2020 Hello! I almost have done! I follow your instructions and I am almost there... You should have told me from the beginning to try it. Even in a trial version it would have saved me from many hours of coding.🥴 Now I am testing my module and seems that working...🙏 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