Hey, thank you for this simple but very effective contribution!
I modified it a little to suit my needs, because
1. I wanted to put a blank image on top of the product image to disable users from copying the file
2. I wanted to put alternative content for users with javascript disabled like in the original product_info.php, because now, if a user has disabled javascript, the product image will be shown twice.
Just to share what I did and find possible errors in my code, here are the changes I made:
1. in enlarge.js
I replaced:
crossobj.innerHTML='<div align="right" id="dragbar"><span id="closetext" onClick="closepreview()">Close Window [x] </span> </div><img src="'+which+'" onClick="closepreview();">'
with:
crossobj.innerHTML='<div align="right" id="dragbar"><span id="closetext" onClick="closepreview()">[x] </span> </div><div style="background-image:url('+which+')"><img src="images/pixel_blank.gif" width="'+imgwidth+'" height="'+imgheight+'" onClick="closepreview();"></div>'
2. in product_info.php (Step 6 in the Help file)
-Instead of the suggested replacement-
I replaced:
<script language="javascript"><!--
document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT , 'hspace="5" vspace="5"') . '</a>'; ?>');
//--></script>
with:
<script language="javascript"><!--
document.write('<?php if (is_file(DIR_WS_IMAGES . $product_info['products_image'])) {
list($w, $h) = getimagesize(DIR_WS_IMAGES . $product_info['products_image']);
echo '<a href="#" onclick="return enlarge(\\\'' . DIR_WS_IMAGES . $product_info['products_image'] . '\\\',event,\\\'center\\\',' . $w . ',' . $h . ');return false;">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a><br>';
} else { echo tep_image(DIR_WS_PRODUCT_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"');
}
?>');
//--></script>
Thanks again for this contribution,
Patrick