So, dropped the product image zoom version of the above. Instead went with incorporating the existing zoom functionality of IH4, which I know Diva you dislike... :)
Recommend adding to the IH4 installation package (and associated SQL) the following file:
includes/templates/IH_INSTALL/templates/tpl_modules_main_product_image.php
Code:
<?php
/**
* Module Template
*
* @package templateSystem
* @copyright Copyright 2003-2011 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: tpl_modules_main_product_image.php 18698 2011-05-04 14:50:06Z wilt $
* Modified to support zoom functionality in IH4 by mc12345678 2014-11-02.
*/
?>
<?php require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_MAIN_PRODUCT_IMAGE));
if ($products_image != '') {
if (function_exists('handle_image')) {
$newimg = handle_image($products_image_large, addslashes($products_name), LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT, '');
list($src, $alt, $width, $height, $parameters) = $newimg;
$products_image_large_test = zen_output_string($src);
if (file_exists($products_image_large_test)) {
$products_image_large = $products_image_large_test;
$newimg2 = handle_image(DIR_WS_IMAGES . $products_image, addslashes($products_name), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, '');
list(, , , , $parameters2) = $newimg2;
}
}
}
?>
<div id="productMainImage" class="centeredContent back">
<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(addslashes($products_image_medium), addslashes($products_name), MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT, /* Begin add 2 of 2 by mc12345678 14-11-02 */ addslashes($parameters2) /* End add 2 of 2 by mc12345678 14-11-02 */ ) . '<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, /* Begin add 2 of 2 by mc12345678 14-11-02 */ addslashes($parameters2) /* End add 2 of 2 by mc12345678 14-11-02 */ ) . '<br /><span class="imgLink">' . TEXT_CLICK_TO_ENLARGE . '</span></a>';
?>
</noscript>
</div>
The above does not require any additional switch to turn on/off the zoom functionality as it is auto controlled when it comes to the builtin zoom functionality.
As for the other code to co-work with what cvhainb put together, well, the constant to check against is:
ZOOM_SMALL_IMAGES
and can be anded (&&) with the file_exists check above for the auto_loader file in each of the single lines.
If it really becomes something necessary to post, then can, but above uses the hover on image to enlarge
feature of IH4.
Peace.
Bookmarks