How can I edit actinicsearch.js to use the extended info image as the search result product image (<actinic:variable name="SearchResultProductImage" />)?
Thanks
Jonathan
Thanks
Jonathan
<actinic:block php="true" >
// AutoProductImages V2.00
include_once 'dpimagesupport.php';
$DefaultProductImageWidth = 450;
$DefaultProductImageHeight = 450;
$ToolTipProductImageWidth = 160;
$ToolTipProductImageHeight = 160;
$ToolTipOffsetX = 0 + '20';
$ToolTipOffsetY = 0 + '20';
$GenerateToolTip = 0;
$ScaledImageQuality = 100;
$ProductImageFileName = '<actinic:variable name="ExtendedInfoImage" selectable="false" />';
$ImageBackgroundColour = 'white';
$ProductImageWidth = '<actinic:variable name="ExtendedInfoImageWidth" selectable="false" />';
$ProductImageHeight = '<actinic:variable name="ExtendedInfoImageHeight" selectable="false" />';
$MakeProgressiveJpg = 1;
$ProductImageFileName = str_replace('\\', '/', $ProductImageFileName); // replace troublesome backslashes
$ProductName = htmlspecialchars('<actinic:variable name="ProductName" encoding="html" selectable="false" />');
unset($ProductImageMd5);
unset($bkgndr);
unset($ProductImage);
$errmessage = '';
$ScaledImageName = $ProductImageFileName;
if ( ($ProductImageWidth != $DefaultProductImageWidth) || ($ProductImageHeight != $DefaultProductImageHeight) )
{
// we have to resize
if ( strlen($ImageBackgroundColour) != 6 ) $ImageBackgroundColour = 'ffffff'; // use white as default
$bkgndr = hexdec(substr($ImageBackgroundColour, 0, 2)); // use defined values
$bkgndg = hexdec(substr($ImageBackgroundColour, 2, 2));
$bkgndb = hexdec(substr($ImageBackgroundColour, 4, 2));
$ProductImageMd5 = md5_file($ProductImageFileName);
$ScaledImageName = 'auto-resize/api_' . $ProductImageMd5 . '_' . $DefaultProductImageWidth . '_' . $DefaultProductImageHeight
. '_' . $ImageBackgroundColour . '_' . $ScaledImageQuality . '.jpg';
if ( ! file_exists($ScaledImageName) )
{
list($errmessage, $ProductImage, $TempImageWidth, $TempImageHeight, $ProductImageType) = imageopen($ProductImageFileName);
if ( $errmessage == '' )
{
$ScaledProductImage = fitandscaleimage($ProductImage, $DefaultProductImageWidth, $DefaultProductImageHeight, $bkgndr, $bkgndg, $bkgndb);
$errmessage .= saveimageforced($ScaledProductImage, $ScaledImageName, $ScaledImageQuality);
}
}
}
if ( $GenerateToolTip && ($errmessage == '') )
{
$ToolTipFileName = $ProductImageFileName;
if ( ($ProductImageWidth != $ToolTipProductImageWidth) || ($ProductImageHeight != $ToolTipProductImageHeight) )
{
// we have to resize
if (! isset($ProductImageMd5) ) $ProductImageMd5 = md5_file($ProductImageFileName);
$ToolTipFileName = 'auto-section-thumbnails/app_' . $ProductImageMd5 . '_' . $ToolTipProductImageWidth . '_' . $ToolTipProductImageHeight
. '_' . $ImageBackgroundColour . '_' . $ScaledImageQuality . '_' . $MakeProgressiveJpg . '.jpg';
if (! isset($bkgndr) )
{
if ( strlen($ImageBackgroundColour) != 6 ) $ImageBackgroundColour ='ffffff'; // use white as default
$bkgndr = hexdec(substr($ImageBackgroundColour, 0, 2)); // use defined values
$bkgndg = hexdec(substr($ImageBackgroundColour, 2, 2));
$bkgndb = hexdec(substr($ImageBackgroundColour, 4, 2));
}
if ( ! file_exists($ToolTipFileName) )
{
if ( ! isset($ProductImage) )
{
list($errmessage, $ProductImage, $TempImageWidth, $TempImageHeight, $ProductImageType) = imageopen($ProductImageFileName);
}
if ( $errmessage == '' )
{
$ScaledToolTipImage = fitandscaleimage($ProductImage, $ToolTipProductImageWidth, $ToolTipProductImageHeight, $bkgndr, $bkgndg, $bkgndb);
if ( $MakeProgressiveJpg ) imageinterlace($ScaledToolTipImage, 1);
$errmessage .= saveimageforced($ScaledToolTipImage, $ToolTipFileName, $ScaledImageQuality);
}
}
}
}
if ( $errmessage == '' )
{
// generate the IMG tag
echo "<img src=\"$ScaledImageName\" border=\"0\" width=\"$DefaultProductImageWidth\" height=\"$DefaultProductImageHeight\"";
echo " alt=\"<actinic:variable name="ProductName" selectable="false" />\"";
if ( $GenerateToolTip )
{
echo " onmouseover=\"ddrivetip('$ProductName','$ToolTipFileName','',$ToolTipProductImageWidth,$ToolTipOffsetX,$ToolTipOffsetY);\"";
echo " onmouseout=\"hideddrivetip();\"";
}
echo "/>";
}
else
{
echo "<font color=red>ERROR: $errmessage - $ScaledImageName </font>";
}
</actinic:block>
<actinic:block if="%3cactinic%3avariable%20name%3d%22IsProductImageDisplayed%22%20%2f%3e">
<actinic:variable name="PinterestButtonLayout" value="Product Pin It Button Layout" />
</actinic:block>
Comment