(1) How do I modify the "Click to enlarge" link so that the popup window contains a different image instead of the same product image? For example, the small product image is "myimage.jpg", but the popup window contains the "myimage_larger.jpg"?
(2) How do I store product image in an user-defined folder instead of the default images folder? For example, I want a new product image to be stored in the "images/userfolder/myimage.jpg".
Thanks.
Latest News: (loading..)
"Click to enlarge" link + User-defined image folder
Started by alexloh, Feb 15 2009, 16:10
4 replies to this topic
#1
Posted 15 February 2009, 16:10
#2
Posted 15 February 2009, 19:59
- :: Jim :: -
- My Toolbox ~ Adobe Web Bundle & WinMerge | Install ~ osCommercev2.2 MS2 060817 -
- Not 4 Hire ~ Please DO NOT PM me for help. I really do not have a clue what I am doing! -
- Working on a new 2.3.1 install -
- My Toolbox ~ Adobe Web Bundle & WinMerge | Install ~ osCommerce
- Not 4 Hire ~ Please DO NOT PM me for help. I really do not have a clue what I am doing! -
- Working on a new 2.3.1 install -
#3
Posted 18 February 2009, 04:27
Hi jhande,
(1) I didn't use the Big Images Modification v1.25, because it was not compatible with my version. Instead, I modified the tep_image() function in includes/functions/html_out.php and renamed it to tep_image_larger(). So that it would get a larger image of the product and display it in the popup... I know the modified function is far from perfect, but I have to get things running before I could get a suitable add-on.
Some limitations of the modified function:
- The name of the larger image must be the same as the normal image with "_L" appended. For example, if the normal image filename is "myproduct.jpg", then the larger image filename has to be "myproduct_L.jpg".
- The larger image needs to be manually uploaded to server...
(2) By the way, the Image Subdirectory Support (Enhanced) is a good add-on
Thanks.
(1) I didn't use the Big Images Modification v1.25, because it was not compatible with my version. Instead, I modified the tep_image() function in includes/functions/html_out.php and renamed it to tep_image_larger(). So that it would get a larger image of the product and display it in the popup... I know the modified function is far from perfect, but I have to get things running before I could get a suitable add-on.
Some limitations of the modified function:
- The name of the larger image must be the same as the normal image with "_L" appended. For example, if the normal image filename is "myproduct.jpg", then the larger image filename has to be "myproduct_L.jpg".
- The larger image needs to be manually uploaded to server...
////
// a modified tep_image() function to display the larger product image, if any.
function tep_image_larger($src, $alt = '', $width = '', $height = '', $parameters = '') {
if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
return false;
}
$src_larger = substr_replace(tep_output_string($src), '_L' . substr(tep_output_string($src), -4), -4); // get the larger image's filename
$image = '<img src="' . $src_larger . '" border="0" alt="' . tep_output_string($alt) . '"'; // display the larger image
if (tep_not_null($alt)) {
$image .= ' title=" ' . tep_output_string($alt) . ' "';
}
if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
if ($image_size = @getimagesize($src_larger)) { // get the larger image's size
if (empty($width) && tep_not_null($height)) {
$ratio = $height / $image_size[1];
$width = intval($image_size[0] * $ratio);
} elseif (tep_not_null($width) && empty($height)) {
$ratio = $width / $image_size[0];
$height = intval($image_size[1] * $ratio);
} elseif (empty($width) && empty($height)) {
$width = $image_size[0];
$height = $image_size[1];
}
} elseif (IMAGE_REQUIRED == 'false') {
return false;
}
}
if (tep_not_null($width) && tep_not_null($height)) {
$image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"';
}
if (tep_not_null($parameters)) $image .= ' ' . $parameters;
$image .= '>';
return $image;
}
(2) By the way, the Image Subdirectory Support (Enhanced) is a good add-on
Thanks.
#4
Posted 22 November 2009, 00:48
Thanks so much for sharing this. That seems like exactly what I want to do, I'm going to try it and see if I can make it work on this TemplateMoster monstrosity I'm trying to make work.
#5
Posted 22 November 2009, 01:25
No, that didn't work for me I got an undefined function error in the html output file
Back to the drawing board as this is exactly what I want to do!














