Re: Image Handler 2 Support
Just wanted to check something..
I have just installed the latest version of IH2 (Ver2 Rev8c). I also had previously installed Fual Slimbox. I have added/deleted the relevant new IH2 files and then I added the following code to roughly line #99 of the includes/modules/your_template/additional_images.php file which is included in the latest IH2 files:
Code:
// bof Zen Lightbox v1.4 aclarke 2007-09-22
if (ZEN_LIGHTBOX_STATUS == 'true' || FUAL_SLIMBOX == 'true') {
$script_link = '<script language="javascript" type="text/javascript"><!--' . "\n" . 'document.write(\'' . ($flag_display_large ? '<a href="' . zen_lightbox($products_image_large, addslashes($products_name), LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT) . '" rel="lightbox[gallery]" title="' . addslashes($products_name) . '">' . $thumb_slashes . '<br />' . TEXT_CLICK_TO_ENLARGE . '</a>' : $thumb_slashes) . '\');' . "\n" . '//--></script>';
} else {
$script_link = '<script language="javascript" type="text/javascript"><!--' . "\n" . 'document.write(\'' . ($flag_display_large ? '<a href="javascript:popupWindow(\\\'' . $large_link . '\\\')">' . $thumb_slashes . '<br />' . TEXT_CLICK_TO_ENLARGE . '</a>' : $thumb_slashes) . '\');' . "\n" . '//--></script>';
}
// eof Zen Lightbox v1.4 aclarke 2007-09-22
So now my WHOLE includes/modules/your_template/additional_images.php file looks like this:
Code:
<?php
/**
* additional_images module
*
* Prepares list of additional product images to be displayed in template
*
* @package templateSystem
* @copyright Copyright 2003-2010 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: additional_images.php 16913 2010-07-16 03:38:06Z ajeh $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
if (!defined('IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE')) define('IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE','Yes');
$images_array = array();
// do not check for additional images when turned off
if ($products_image != '' && $flag_show_product_info_additional_images != 0) {
// prepare image name
$products_image_extension = substr($products_image, strrpos($products_image, '.'));
$products_image_base = str_replace($products_image_extension, '', $products_image);
// if in a subdirectory
if (strrpos($products_image, '/')) {
$products_image_match = substr($products_image, strrpos($products_image, '/')+1);
//echo 'TEST 1: I match ' . $products_image_match . ' - ' . $file . ' - base ' . $products_image_base . '<br>';
$products_image_match = str_replace($products_image_extension, '', $products_image_match) . '_';
$products_image_base = $products_image_match;
}
$products_image_directory = str_replace($products_image, '', substr($products_image, strrpos($products_image, '/')));
if ($products_image_directory != '') {
$products_image_directory = DIR_WS_IMAGES . str_replace($products_image_directory, '', $products_image) . "/";
} else {
$products_image_directory = DIR_WS_IMAGES;
}
// Check for additional matching images
$file_extension = $products_image_extension;
$products_image_match_array = array();
if ($dir = @dir($products_image_directory)) {
while ($file = $dir->read()) {
if (!is_dir($products_image_directory . $file)) {
if (substr($file, strrpos($file, '.')) == $file_extension) {
if(preg_match("/" . $products_image_base . "/i", $file) == 1) {
if ($file != $products_image) {
if ($products_image_base . str_replace($products_image_base, '', $file) == $file) {
//echo 'I AM A MATCH ' . $file . '<br />';
$images_array[] = $file;
} else {
// echo 'I AM NOT A MATCH ' . $file . '<br />';
}
}
}
}
}
}
if (sizeof($images_array)) {
sort($images_array);
}
$dir->close();
}
}
// Build output based on images found
$num_images = sizeof($images_array);
$list_box_contents = '';
$title = '';
if ($num_images) {
$row = 0;
$col = 0;
if ($num_images < IMAGES_AUTO_ADDED || IMAGES_AUTO_ADDED == 0 ) {
$col_width = floor(100/$num_images);
} else {
$col_width = floor(100/IMAGES_AUTO_ADDED);
}
for ($i=0, $n=$num_images; $i<$n; $i++) {
$file = $images_array[$i];
$products_image_large = str_replace(DIR_WS_IMAGES, DIR_WS_IMAGES . 'large/', $products_image_directory) . str_replace($products_image_extension, '', $file) . IMAGE_SUFFIX_LARGE . $products_image_extension;
// Begin Image Handler changes 1 of 2
// $flag_has_large = file_exists($products_image_large);
$flag_has_large = true;//file_exists($products_image_large);
// End Image Handler changes 1 of 2
$products_image_large = ($flag_has_large ? $products_image_large : $products_image_directory . $file);
$flag_display_large = (IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE == 'Yes' || $flag_has_large);
$base_image = $products_image_directory . $file;
$thumb_slashes = zen_image($base_image, addslashes($products_name), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
// Begin Image Handler changes 2 of 2 remove additional single quotes from image attributes (important!)
$thumb_slashes = preg_replace("/([^\\\\])'/", '$1\\\'', $thumb_slashes);
// End Image Handler changes 2 of 2
$thumb_regular = zen_image($base_image, $products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
$large_link = zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, 'pID=' . $_GET['products_id'] . '&pic=' . $i . '&products_image_large_additional=' . $products_image_large);
// Link Preparation:
// bof Zen Lightbox v1.4 aclarke 2007-09-22
if (ZEN_LIGHTBOX_STATUS == 'true' || FUAL_SLIMBOX == 'true') {
$script_link = '<script language="javascript" type="text/javascript"><!--' . "\n" . 'document.write(\'' . ($flag_display_large ? '<a href="' . zen_lightbox($products_image_large, addslashes($products_name), LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT) . '" rel="lightbox[gallery]" title="' . addslashes($products_name) . '">' . $thumb_slashes . '<br />' . TEXT_CLICK_TO_ENLARGE . '</a>' : $thumb_slashes) . '\');' . "\n" . '//--></script>';
} else {
$script_link = '<script language="javascript" type="text/javascript"><!--' . "\n" . 'document.write(\'' . ($flag_display_large ? '<a href="javascript:popupWindow(\\\'' . $large_link . '\\\')">' . $thumb_slashes . '<br />' . TEXT_CLICK_TO_ENLARGE . '</a>' : $thumb_slashes) . '\');' . "\n" . '//--></script>';
}
// eof Zen Lightbox v1.4 aclarke 2007-09-22
$noscript_link = '<noscript>' . ($flag_display_large ? '<a href="' . zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, 'pID=' . $_GET['products_id'] . '&pic=' . $i . '&products_image_large_additional=' . $products_image_large) . '" target="_blank">' . $thumb_regular . '<br /><span class="imgLinkAdditional">' . TEXT_CLICK_TO_ENLARGE . '</span></a>' : $thumb_regular ) . '</noscript>';
// $alternate_link = '<a href="' . $products_image_large . '" onclick="javascript:popupWindow(\''. $large_link . '\') return false;" title="' . $products_name . '" target="_blank">' . $thumb_regular . '<br />' . TEXT_CLICK_TO_ENLARGE . '</a>';
$link = $script_link . "\n " . $noscript_link;
// $link = $alternate_link;
// List Box array generation:
$list_box_contents[$row][$col] = array('params' => 'class="additionalImages centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
'text' => "\n " . $link);
$col ++;
if ($col > (IMAGES_AUTO_ADDED -1)) {
$col = 0;
$row ++;
}
} // end for loop
} // endif
Everything seems to be working fine, I just wanted to check with the experts that the above is ok :smile:
Thanks.
Re: Image Handler 2 Support Upload Error
Hi, I'm getting an error when i try to upload...it was working fine. Here is the error:
Error!
Unable to determine the page link!
Function used:
zen_href_link('', '', 'NONSSL')
How do I fix this? Thank you!
Re: Image Handler 2 Support Upload Error
Quote:
Originally Posted by
joyjoy
Hi, I'm getting an error when i try to upload...it was working fine. Here is the error:
Error!
Unable to determine the page link!
Function used:
zen_href_link('', '', 'NONSSL')
How do I fix this? Thank you!
Normally this is caused by invalid characters in your filename, things like brackets (), filenames should only contain alphanumeric characters as well as underscores and dashes
Unfortunately brackets Mean something in php code, therefore when a filename that contains brackets or other special characters, it send image handler into a spin
Re: Image Handler 2 Support
Thank you for the response. I've tried to upload the pictures with renamed files that contained no special characters. Still getting the error....:frusty:
Re: Image Handler 2 Support
I've figured it out, it was an image that Image Handler allowed to upload previously with "()" marks. I've deleted it out of my files, it's working well again.:smile:
Re: Image Handler 2 Support
Hi All..
Just a quick question is ver 2.0 8b suitable to install on zen 1.3.8a
Thanks
RR
Re: Image Handler 2 Support
Hello all,
I'm new in zen cart v1.3.9f. Glad to know IH2. I want to make sure before installing.
Since there are many same folder names and perhaps files with existing zen cart original fold, Do I need to choose override all while installing? or skip all? I worry corrupt my original zen cart program
if do override all.
Any help, Thanks.
Re: Image Handler 2 Support
Hi I installed IH version 2.0 Rev 8b on zen 1.3.8a, the installation proved successful or at least i think it is.
Though I a puzzled as to why I have different image sizes in my store Subcategory Image width is 120 as is height. PLS see Url http://www.colourshield.com/store
The only thing that fixes them is if I set the following to 0
Image - Use Proportional Images on Products and Categories
However on doing so..the Product Info - Image disappears, has anyone seen this problem and know how to fix it.
Thanks
RR
Re: Image Handler 2 Support
People saying Somehow Google had problems with IH2 links, the problem fixed?
Moreover, what happen when installing upgrade Zen cart? I worry need to re-install IH2 again, it causes a lot of work.