Quote:
Originally Posted by Jayk
That would be a nice feature. My detailed images tend to be around 640 x 480 and that makes for larger size thumbnails without them being resampled.
Cheers,
Jason
|
This is my first attempt at proper coding shoot me down if it's bad.
I added this function to /skin1/common.js
Code:
function build_thumb(images,langLabel,imgNum,imgUrl,imgTitle) {
var obj = document.getElementById('thumbDiv');
if (!obj)
return false;
/* Clear thumbnail Div Object */
if (!images || images.length == 0) {
obj.innerHTML = "nothing";
return false;
}
/* Build Thumbnail String */
var thumbStr = images;
var imageStr = "";
var langLabelStr = langLabel;
var imgNumStr = imgNum;
var imgUrlStr = imgUrl;
var imgTitleStr = imgTitle;
/* Change Folder */
thumbStr = thumbStr.replace(/D/,"T");
imageStr = '<br /><div style="text-align:center;color:black;font-weight:bold;padding:2px;">' +langLabelStr + " " + imgNumStr +' </div><br /><div style="white-space: nowrap;padding-left:10px;"><a href="' + imgUrlStr + '" title="' + imgTitle + '" class="thickbox" rel="[detailed]"><img src="';
imageStr += thumbStr;
imageStr += '" width="150"/></div><br /<br />'
obj.innerHTML += imageStr;
}
and chopped thickbox_productpage.tpl to look like this
Code:
{if $images ne ""}
<div style="white-space:nowrap;color:black;font-weight:bold;padding:2px;margin:10px 0 4px;">{$lng.lbl_detailed_images} ¬</div><br /><br />
{section name=image loop=$images}
{if $images[image].avail eq "Y"}
{if $images[image].tmbn_url}
<div id="thumbDiv"></div><br/><br />
<script type="text/javascript" language="JavaScript 1.2">
<!--
build_thumb("{$images[image].image_path}","{$lng.lbl_image}","{math equation="value+1" value=$smarty.section.image.index}","{$images[image].tmbn_url}","{$images[image].alt|escape}");
-->
</script>
{else}
<div style="white-space: nowrap;padding-left:10px;"><a href="{$xcart_web_dir}/image.php?id={$images[image].imageid}&type=D" title="{$images[image].alt|escape}" class="thickbox" rel="[detailed]"><img src="{$xcart_web_dir}/image.php?id={$images[image].imageid}&type=D" width="135" style="border:0;" alt="{$lng.lbl_click_to_enlarge|escape}" /></a></div><br /><br />
{/if}
{/if}
{/section}
{/if}
It appears to be working for me.
http://www.embroideredcaps.info/4021-Brushed-Heavy-Cotton-with-Sandwich-Trim-p-3.html
Ant