$axZmH = new axZmH($axZm); // Include AJAX-ZOOM configuration file $_GET['example'] = 'magento'; require $magePath . '/axZm/zoomConfig.inc.php'; // Connect to the database $db = Mage::getSingleton('core/resource')->getConnection('core_write'); $table_prefix = Mage::getConfig()->getTablePrefix(); // Select all images in the database. If required change the query to suit your needs. $query = $db->query("SELECT value FROM {$table_prefix}catalog_product_entity_media_gallery GROUP BY value"); // Fetch the query results $rows = $query->fetchAll(PDO::FETCH_ASSOC); $arrayFiles = array(); $arrayDeleted = array(); // Generate an array only with image names without '.jpg' foreach ($rows as $k => $v) { $arrayFiles[] = substr($axZmH->getl('/', $v['value']), 0, -4); } // Start removing if (!empty($arrayFiles)) { // Open the directory with image tiles $handle = opendir($zoom['config']['pyrTilesDir']); while (false !== ($file = readdir($handle))) { // $file is the subfolder with the name of an image without '.jpg' // Compare if the subfolder is in the list comming from the database if (!in_array($file, $arrayFiles) && $file != '.' && $file != '..') { // If not remove the tiles, initial (medium sized images) and eventually thumbnails // There will be nothing deleted which is created by magento, only what was created by AJAX-ZOOM! $axZmH->removeAxZm($zoom, $file . '.jpg', array('In' => true, 'Th' => true, 'Ti' => true), false); // Store the filename in an array $arrayDeleted[] = $file; }
$zoom['config']['pyrProgImLimit']['threads'] = false; // false or integer (number of threads of execution) $zoom['config']['pyrProgImLimit']['time'] = 300; // false or integer (maximum elapsed time in seconds) */ $zoom['config']['fpPP'] = $axZmH->checkSlash($zoom['config']['fpPP'], 'remove'); $zoom['config']['iconDir'] = $axZmH->checkSlash($zoom['config']['fpPP'] . $zoom['config']['icon'], 'add'); $zoom['config']['picDir'] = $axZmH->checkSlash($zoom['config']['fpPP'] . $zoom['config']['pic'], 'add'); $zoom['config']['thumbDir'] = $axZmH->checkSlash($zoom['config']['fpPP'] . $zoom['config']['thumbs'], 'add'); $zoom['config']['tempDir'] = $axZmH->checkSlash($zoom['config']['fpPP'] . $zoom['config']['temp'], 'add'); $zoom['config']['galleryDir'] = $axZmH->checkSlash($zoom['config']['fpPP'] . $zoom['config']['gallery'], 'add'); $zoom['config']['fontDir'] = $axZmH->checkSlash($zoom['config']['fpPP'] . $zoom['config']['fontPath'], 'add'); $zoom['config']['gPyramidDir'] = $axZmH->checkSlash($zoom['config']['fpPP'] . $zoom['config']['gPyramidPath'], 'add'); $zoom['config']['pyrTilesDir'] = $axZmH->checkSlash($zoom['config']['fpPP'] . $zoom['config']['pyrTilesPath'], 'add'); $zoom['config']['mapDir'] = $axZmH->checkSlash($zoom['config']['fpPP'] . $zoom['config']['mapPath'], 'add'); $zoom['config']['tempCacheDir'] = $axZmH->checkSlash($zoom['config']['fpPP'] . $zoom['config']['tempCache'], 'add'); $zoom['config']['picX'] = intval($axZmH->getf('x', $zoom['config']['picDim'])); $zoom['config']['picY'] = intval($axZmH->getl('x', $zoom['config']['picDim'])); $zoom['config']['galPicX'] = intval($axZmH->getf('x', $zoom['config']['galleryPicDim'])); $zoom['config']['galPicY'] = intval($axZmH->getl('x', $zoom['config']['galleryPicDim'])); $zoom['config']['galFullPicX'] = intval($axZmH->getf('x', $zoom['config']['galleryFullPicDim'])); $zoom['config']['galFullPicY'] = intval($axZmH->getl('x', $zoom['config']['galleryFullPicDim'])); $zoom['config']['galHorPicX'] = intval($axZmH->getf('x', $zoom['config']['galleryHorPicDim'])); $zoom['config']['galHorPicY'] = intval($axZmH->getl('x', $zoom['config']['galleryHorPicDim'])); ####################################################################################### #################################### Batch parameters ################################# ####################################################################################### // PHP_SELF should be ok for iframe // for includes /path/to/cms/zoomBatch.php $zoom['batch']['selfFile'] = $_SERVER['PHP_SELF']; // Define the start (home) directory where images are located (for dropdown option list) $zoom['batch']['startPic'] = $zoom['config']['pic']; // Preview image settings in the file list