예제 #1
0
    // Select additional images
    $q = mysql_query("SELECT file FROM " . TABLE_MEDIA . " WHERE type='images' AND class='product'");
    while ($r = mysql_fetch_assoc($q)) {
        // Add additional images to the array
        $arrayFiles[] = substr($r['file'], 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;
        }
    }
    // Return messages
    if (!empty($arrayDeleted)) {
        echo count($arrayDeleted) . ' images have been cleaned.';
    } else {
        echo 'There are no images to be cleaned. All ' . count($arrayFiles) . ' images seem to be used.';
    }
} else {
    echo 'There are no images in the database.';
}
예제 #2
0
}
// Ajax change directory
if ($_GET['dir'] and $_GET['dirReplace']) {
    $retScript = "<script type=\"text/javascript\">";
    $retScript .= "\n\t\t\$('#batchList').html('" . $axZmH->batchList($zoom, $pic_list_array, $pic_list_data) . "');\n\t\t\$.zoomBatch.trOver();\n\t";
    $retScript .= "</script>";
    echo $retScript;
    exit;
}
// Ajax Delete all thumbs, initial image(s) etc
// The original file will not be deleted, unless you set the last parameter of the method removeAxZm to true!
if (isset($_GET['delPic']) and $zoom['batch']['allowDelete']) {
    ob_start();
    if (!empty($pic_list_array)) {
        if ($pic_list_array[(int) $_GET['delPic']]) {
            $axZmH->removeAxZm($zoom, $pic_list_array[$_GET['delPic']], $arrDel = $zoom['batch']['arrayMake'], false);
            $retScript = "<script type=\"text/javascript\">";
            $retScript .= $zoom['batch']['arrayMake']['In'] ? "\$('#In" . $_GET['delPic'] . "').attr('src','" . $zoom['config']['icon'] . $zoom['batch']['iconNames']['Error'] . "');" : '';
            $retScript .= $zoom['batch']['arrayMake']['Th'] ? "\$('#Th" . $_GET['delPic'] . "').attr('src','" . $zoom['config']['icon'] . $zoom['batch']['iconNames']['Error'] . "');" : '';
            $retScript .= $zoom['batch']['arrayMake']['gP'] ? "\$('#gP" . $_GET['delPic'] . "').attr('src','" . $zoom['config']['icon'] . $zoom['batch']['iconNames']['Error'] . "');" : '';
            $retScript .= $zoom['batch']['arrayMake']['Ti'] ? "\$('#Ti" . $_GET['delPic'] . "').attr('src','" . $zoom['config']['icon'] . $zoom['batch']['iconNames']['Error'] . "');" : '';
            $retScript .= "</script>";
            echo $retScript;
        }
    }
    ob_end_flush();
    exit;
}
// Ajax Delete all thumbs, initial image(s) etc for selected files
if (isset($_GET['submitDelete']) and $zoom['batch']['allowBatchDelete']) {
    $retScript = "<script type=\"text/javascript\">";