Hi Try this Code for tpl_modules_main_product_image.php not the best way but it is working
for additional_images.phpPHP Code:<?php
/**
* (C) CopyRight 2008 MagicToolBox - www.magictoolbox.com - [email protected]
*/
// includes/modules/
$defaultView = false;
?>
<?php require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_MAIN_PRODUCT_IMAGE)); ?>
<div id="productMainImage" class="centeredContent back">
<?php if (ZEN_MAGICZOOM_STATUS == 'true') { ?>
<?php
$products_name = $current_page_base == 'product_reviews' ? $products_name_reviews_page : $products_name;
$tplDIR = $db->Execute("select template_dir from " . TABLE_TEMPLATE_SELECT);
$tplDIR = $tplDIR->fields['template_dir'];
require_once(DIR_FS_CATALOG . DIR_WS_MODULES . 'magictoolbox/magictoolbox_addons.php');
/* load module */
$mod = & magictoolboxLoadModule('MagicZoom');
if(file_exists(DIR_FS_CATALOG . DIR_WS_IMAGES . str_replace(DIR_WS_IMAGES, '', $products_image_large))) {
$image = str_replace(DIR_WS_IMAGES, '', $products_image_large);
} else {
$image = str_replace(DIR_WS_IMAGES, '', $products_image);
}
if(file_exists(DIR_FS_CATALOG . DIR_WS_IMAGES . $image) && $mod->params->checkValue("use-effect-on-product-page", "Yes")) {
if ($mod->type == 'standard') {
if(isset($_GET['products_id'])) $pid = $_GET['products_id']; else $pid = null;
$img = DIR_WS_CATALOG . magictoolboxGetThumb($image, 'original', $mod->params, $pid);
$thumb = DIR_WS_CATALOG . magictoolboxGetThumb($image, 'thumb', $mod->params, $pid);
$id = 'MainImage';
$title = $products_name;
$description = $products_description;
/* zen_image($products_image_medium, addslashes($products_name), MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT) */
/* javascript:popupWindow(\\\'' . zen_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $_GET['products_id']) . '\\\') */
if(!defined('MAGICZOOM_ADDONS_TEMPLATE_LOADED')) {
echo $mod->addonsTemplate(DIR_WS_CATALOG . DIR_WS_TEMPLATE . 'images');
define('MAGICZOOM_ADDONS_TEMPLATE_LOADED', true);
}
if (ZEN_LIGHTBOX_STATUS == 'true') {
if (ZEN_LIGHTBOX_GALLERY_MODE == 'true' && ZEN_LIGHTBOX_GALLERY_MAIN_IMAGE == 'true') {
$rel = 'lightbox-g';
} else {
$rel = 'lightbox';
}
$img = zen_lightbox($products_image_large). '" rel="' . $rel ;
?>
<script language="javascript" type="text/javascript"><!--
document.write('<?php echo $mod->template(compact("img","thumb","id","title","description")); ?>');
//--></script>
<?php }
} elseif($mod->type == 'category') {
require(DIR_FS_CATALOG . DIR_WS_MODULES . $tplDIR . '/additional_images.php');
if(count($images) > 1) {
foreach($images as $k => $img) {
$images[$k]['img'] = $images[$k]['medium'];
}
echo $mod->template($images);
} else {
$defaultView = true;
}
} elseif($mod->type == 'circle') {
require(DIR_FS_CATALOG . DIR_WS_MODULES . $tplDIR . '/additional_images.php');
if(count($images) > 0 && $mod->enabled($images, $products_id)) {
echo $mod->template($images);
} else {
$defaultView = true;
}
} else {
$defaultView = true;
}
} else {
$defaultView = true;
}
?>
<?php } else { $defaultView = true; } ?>
<?php if($defaultView) { $GLOBALS['MAGICTOOLBOX_additional_images_defaultView'] = true; ?>
<script language="javascript" type="text/javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . zen_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $_GET['products_id']) . '\\\')">' . zen_image($products_image_medium, addslashes($products_name), MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT) . '<br /><span class="imgLink">' . TEXT_CLICK_TO_ENLARGE . '</span></a>'; ?>');
//--></script>
<noscript><?php echo '<a href="' . zen_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $_GET['products_id']) . '" target="_blank">' . zen_image($products_image_medium, $products_name, MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT) . '<br /><span class="imgLink">' . TEXT_CLICK_TO_ENLARGE . '</span></a>'; ?></noscript>
<?php } ?>
</div>
best wishes from GermanyPHP Code:<?php
/**
* (C) CopyRight 2008 MagicToolBox - www.magictoolbox.com - [email protected]
*/
/*
image/
.....
subdir/
......
imageName.extension - base
imageName**.extension - additional
large/imageName**_LRG.extension - large images
medium/imageName**_MED.extension - medium images
MagicToolbox use only large images. All thumbnails will be dinamicaly created
*/
if (!defined('IS_ADMIN_FLAG')) die('Illegal Access');
if(!isset($GLOBALS['MAGICTOOLBOX_additional_images_defaultView'])) {
$GLOBALS['MAGICTOOLBOX_additional_images_defaultView'] = false;
}
if (!defined('IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE')) define('IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE','Yes');
$images_array = array();
if ($products_image != '' && $flag_show_product_info_additional_images != 0) {
// prepare image name
$products_image_extension = substr($products_image, strrpos($products_image, '.'));
$products_image_base = str_replace($products_image_extension, '', $products_image);
// if in a subdirectory
if (strrpos($products_image, '/')) {
$products_image_match = substr($products_image, strrpos($products_image, '/')+1);
//echo 'TEST 1: I match ' . $products_image_match . ' - ' . $file . ' - base ' . $products_image_base . '<br>';
$products_image_match = str_replace($products_image_extension, '', $products_image_match) . '_';
$products_image_base = $products_image_match;
}
$products_image_directory = str_replace($products_image, '', substr($products_image, strrpos($products_image, '/')));
if ($products_image_directory != '') {
$products_image_directory = DIR_WS_IMAGES . str_replace($products_image_directory, '', $products_image) . "/";
} else {
$products_image_directory = DIR_WS_IMAGES;
}
// Check for additional matching images
$file_extension = $products_image_extension;
$products_image_match_array = array();
if ($dir = @dir($products_image_directory)) {
while ($file = $dir->read()) {
if (!is_dir($products_image_directory . $file)) {
if (substr($file, strrpos($file, '.')) == $file_extension) {
// if(preg_match("/" . $products_image_match . "/i", $file) == '1') {
if(preg_match("/" . $products_image_base . "/i", $file) == 1) {
if ($file != $products_image) {
if ($products_image_base . str_replace($products_image_base, '', $file) == $file) {
// echo 'I AM A MATCH ' . $file . '<br>';
$images_array[] = $file;
} else {
// echo 'I AM NOT A MATCH ' . $file . '<br>';
}
}
}
}
}
}
if (sizeof($images_array)) {
sort($images_array);
}
$dir->close();
}
}
// Build output based on images found
$num_images2 = sizeof($images_array);
$list_box_contents2 = '';
$title2 = '';
if ($num_images2) {
$row2 = 0;
$col2 = 0;
if ($num_images2 < IMAGES_AUTO_ADDED || IMAGES_AUTO_ADDED == 0 ) {
$col_width2 = floor(100/$num_images2);
} else {
$col_width2 = floor(100/IMAGES_AUTO_ADDED);
}
for ($i2=0, $n=$num_images2; $i2<$n; $i2++) {
$file = $images_array[$i2];
$products_image_large = str_replace(DIR_WS_IMAGES, DIR_WS_IMAGES . 'large/', $products_image_directory) . str_replace($products_image_extension, '', $file) . IMAGE_SUFFIX_LARGE . $products_image_extension;
// bof Zen Lightbox 2008-12-11 aclarke
if (function_exists('handle_image')) {
$flag_has_large = true;
} else {
// eof Zen Lightbox 2008-12-11 aclarke
$flag_has_large = file_exists($products_image_large);
// bof Zen Lightbox 2008-12-11 aclarke
}
// eof Zen Lightbox 2008-12-11 aclarke
$products_image_large = ($flag_has_large ? $products_image_large : $products_image_directory . $file);
$flag_display_large = (IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE == 'Yes' || $flag_has_large);
$base_image = $products_image_directory . $file;
$thumb_slashes = zen_image($base_image, addslashes($products_name), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
// bof Zen Lightbox 2008-12-11 aclarke
if (function_exists('handle_image')) {
// remove additional single quotes from image attributes (important!)
$thumb_slashes = preg_replace("/([^\\\\])'/", '$1\\\'', $thumb_slashes);
}
// eof Zen Lightbox 2008-12-11 aclarke
$thumb_regular = zen_image($base_image, $products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
$large_link = zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, 'pID=' . $_GET['products_id'] . '&pic=' . $i . '&products_image_large_additional=' . $products_image_large);
$script_link = '<script language="javascript" type="text/javascript"><!--' . "\n" . 'document.write(\'' . ($flag_display_large ? '<a href="' . zen_lightbox($products_image_large, addslashes($products_name), LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT) . '" rel="' . $rel . '" title="' . addslashes($products_name) . '">' . $thumb_slashes . '<br />' . TEXT_CLICK_TO_ENLARGE . '</a>' : $thumb_slashes) . '\');' . "\n" . '//--></script>';
echo ('<div style="display:none" >' .$script_link .'</div>');
} }
// if Magic Zoom enabled
if (ZEN_MAGICZOOM_STATUS == 'true' && !$GLOBALS['MAGICTOOLBOX_additional_images_defaultView']) {
//load module
require_once(DIR_FS_CATALOG . DIR_WS_MODULES . 'magictoolbox/magictoolbox_addons.php');
$mod = & magictoolboxLoadModule('MagicZoom');
$images = array();
if(!isset($GLOBALS['magictoolbox']['images'])) {
// we can load additional images only if base image present
if (!empty($products_image)) {
$info = pathinfo($products_image);
if(intval(phpversion()) < 5 || !isset($info["filename"])) {
$info["filename"] = basename($info["basename"], ".".$info["extension"]);
}
if($info["dirname"] == '.') $info["dirname"] = '';
if(!empty($info["dirname"])) $info["dirname"] .= '/';
$images = glob(DIR_FS_CATALOG . DIR_WS_IMAGES . $info["dirname"] . $info["filename"] . '*.' . $info["extension"]);
// found only original image
//if (count($images) == 1) $images = array();
// sort images
if (count($images) > 0) {
sort($images);
$_images = array();
foreach($images as $img) {
if($img == DIR_FS_CATALOG . DIR_WS_IMAGES . $info["dirname"] . $info["filename"] . '.' . $info["extension"]) {
$main = true;
} else {
$main = false;
}
$img = str_replace(DIR_FS_CATALOG . DIR_WS_IMAGES, '', $img);
$info = pathinfo($img);
if(intval(phpversion()) < 5 || !isset($info["filename"])) {
$info["filename"] = basename($info["basename"], ".".$info["extension"]);
}
if($info["dirname"] == '.') $info["dirname"] = '';
if(!empty($info["dirname"])) $info["dirname"] .= '/';
$lrg = 'large/' . $info['dirname'] . $info['filename'] . IMAGE_SUFFIX_LARGE .'.'. $info['extension'];
if(!file_exists(DIR_FS_CATALOG . DIR_WS_IMAGES . $lrg)) $lrg = $img;
if(isset($_GET['products_id'])) $pid = $_GET['products_id']; else $pid = null;
$_images[] = array(
'main' => $main,
'img' => DIR_WS_CATALOG . magictoolboxGetThumb($lrg, 'original', $mod->params, $pid),
'medium' => DIR_WS_CATALOG . magictoolboxGetThumb($lrg, 'thumb', $mod->params, $pid),
'thumb' => DIR_WS_CATALOG . magictoolboxGetThumb($lrg, 'selector', $mod->params, $pid)
);
}
$GLOBALS['magictoolbox']['images'] = $images = $_images;
}
}
} else {
$images = $GLOBALS['magictoolbox']['images'];
}
if($mod->type == 'standard') {
$list_box_contents = array();
$title = '';
$c = count($images);
if ($c > 1) {
$row = $col = 0;
if ($c < IMAGES_AUTO_ADDED || IMAGES_AUTO_ADDED == 0 ) {
$col_width = floor(100/$c);
} else {
$col_width = floor(100/IMAGES_AUTO_ADDED);
}
foreach($images as $image) {
$img = $image['img'];
$medium = $image['medium'];
$thumb = $image['thumb'];
$id = 'MainImage';
$link = '<script language="javascript" type="text/javascript"><!--' . "\n" . 'document.write(\'' . $mod->subTemplate(compact("img","thumb","medium","id")) . '\');' . "\n" . '//--></script>';
//$link = $mod->subTemplate(compact("img","thumb","medium","id"));
// List Box array generation:
$list_box_contents[$row][$col] = array('params' => 'class="additionalImages centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
'text' => "\n " . $link);
$col ++;
if ($col > (IMAGES_AUTO_ADDED -1)) {
$col = 0;
$row ++;
}
}
}
$num_images = $c;
}
} else {
//if disabled Magic Zoom then default template will be loaded
require_once(dirname(dirname(__FILE__)) . "/" . basename(__FILE__));
}
?>


Reply With Quote
