computer_guy Posted November 21, 2012 Share Posted November 21, 2012 (edited) Is there a way to list in admin all products with broken images so that they can be fixed. Thank you for your time. Edited November 21, 2012 by computer_guy (see edit history) Link to comment Share on other sites More sharing options...
Alex Simonchik BelVG Posted November 21, 2012 Share Posted November 21, 2012 Hi, Tool for finding broken images: <?php include_once('config/config.inc.php'); include_once(_PS_ROOT_DIR_ . '/images.inc.php'); error_reporting(E_ALL); ini_set('display_errors', 'on'); $sql = 'SELECT * FROM ps_product LIMIT 1000'; $products = Db::getInstance()->ExecuteS( $sql ); foreach($products as $product){ $productObj = new Product($product['id_product']); $id_lang = Configuration::get('PS_LANG_DEFAULT'); $images = $productObj->getImages($id_lang); $ps_legacy_images = Configuration::get('PS_LEGACY_IMAGES'); foreach($images as $image){ // legacy mode or default image if ($ps_legacy_images) { $filename = _PS_PROD_IMG_DIR_ . $product['id_product'] . ($image['id_image'] ? '-' . $image['id_image'] : '') . '.jpg'; } else { $imageIds = $productObj->id . "-" . $image['id_image']; $split_ids = explode('-', $imageIds); $id_image = (isset($split_ids[1]) ? $split_ids[1] : $split_ids[0]); $filename = _PS_PROD_IMG_DIR_ . Image::getImgFolderStatic($id_image) . $id_image . '.jpg'; } if(!(file_exists($filename))){ echo "File is not exist: " . $filename . ". ID product - " . $productObj->id . "<br>"; } } } Regards Link to comment Share on other sites More sharing options...
Frennsu Posted September 28, 2014 Share Posted September 28, 2014 I do not work, the screen stays blank.It is worth for prestashop 1.6 ?? Link to comment Share on other sites More sharing options...
ayin Posted February 25, 2015 Share Posted February 25, 2015 (edited) bump. How to use this script? Edited February 25, 2015 by ayin (see edit history) Link to comment Share on other sites More sharing options...
Slitherin Posted May 7, 2016 Share Posted May 7, 2016 (edited) Bump, anyone? Someone has updated script? if(!(file_exists($filename))){ echo "File is not exist: " . $filename . ". ID product - " . $productObj->id . "<br>"; } this part doesnt work anymore :/ Edited May 7, 2016 by Slitherin (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts