Re: Image Handler 4 (for v1.5.x) Support Thread
Quote:
Originally Posted by
DivaVocals
Given the issue EHSI is having I still suggest a rollback and re-install..
*nodding head in agreement* but was curious if the system responds differently based on "where" the image is input. Hopefully/expectedly after the reinstall it will work as foreseen, but at least then EHSI will have a deeper understanding of how it all fits together and works.
I did agree to the reinstall right? :) good luck.
Re: Image Handler 4 (for v1.5.x) Support Thread
Quote:
Originally Posted by
DivaVocals
I need to add that I remember reporting to ckosloff that the additional images were an issue when IH was updated for 1.3.9.. I also remember that he and had a bit of back and forth on the matter because he didn't think that what I was reporting was an issue.. That is part of the reason the large image popup got rolled back to an old version from a prior version of Zen Cart to begin with.. I had NO IDEA at the time that this would leave the image popups subject to XSS vulnerabilities.. I just knew that the popups and additional images were not working correctly, and I thought I found a solution..
Anyway.. mc12345678 again.. thanks for your tenacity, and patience.. :smile:
Quite welcome, not to say that I didn't have a vested interest in resolving it. :) Thanks for reaching out for assistance.
Re: Image Handler 4 (for v1.5.x) Support Thread
Quote:
Originally Posted by
mc12345678
Quite welcome, not to say that I didn't have a vested interest in resolving it. :) Thanks for reaching out for assistance.
No seriously.. NO WAY I would have ever been able to fix this.. NEVER!!! Thanks soooooo much!! NOW I am going to go get some lunch!!!
Re: Image Handler 4 (for v1.5.x) Support Thread
Ok, I see all the excitement that it now works. I just don't follow what needs to be done to make it function properly? Can you recap on what you found and what "fix" we need to apply? Thanks.
Re: Image Handler 4 (for v1.5.x) Support Thread
Quote:
Originally Posted by
mydanilo
Ok, I see all the excitement that it now works. I just don't follow what needs to be done to make it function properly? Can you recap on what you found and what "fix" we need to apply? Thanks.
All I would do is search through the post to write up a recap anyway.. So I'm gonna respectfully ask you to go back through the post..I'm on a mobile device right now (at a restaurant), and recapping things including the code on this tiny device will not be easy.. I promise the required changes are QUITE easy to follow.. The code changes is posted around page 78 or 79..
Re: Image Handler 4 (for v1.5.x) Support Thread
Quote:
Originally Posted by
DivaVocals
No seriously.. NO WAY I would have ever been able to fix this.. NEVER!!! Thanks soooooo much!! NOW I am going to go get some lunch!!!
Well, you probably should get some rest too. I saw you were awake a long time. :P
Re: Image Handler 4 (for v1.5.x) Support Thread
Quote:
Originally Posted by
mydanilo
Ok, I see all the excitement that it now works. I just don't follow what needs to be done to make it function properly? Can you recap on what you found and what "fix" we need to apply? Thanks.
The code originally posted and seeming to work is provided here below and at the associated link:
Quote:
Originally Posted by
mc12345678
So here is the code that works for the includes/modules/YOUR_TEMPLATE/additional_images.php:
Code:
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
//next line is commented out for Image Handler
if (function_exists('handle_image')) {
$newimg = handle_image($products_image_large, addslashes($products_name), LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT);
list($src, $alt, $width, $height, $parameters) = $newimg;
$products_image_large = zen_output_string($src);
}
$flag_has_large = file_exists($products_image_large);
// End Image Handler changes 1 of 2
To be coupled with the following code in the includes/templates/YOUR_TEMPLATE/popup_image_additional/tpl_main_page.php file:
Code:
<?php
/**mod Image Handler 4.1
* Override Template for common/tpl_main_page.php
*
* @package templateSystem
* @copyright Copyright 2005-2006 Tim Kroeger
* @copyright Copyright 2003-2005 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: tpl_main_page.php,v 2.0 Rev 8 2010-05-31 23:46:5 DerManoMann Exp $
*/
?>
<body id="popupAdditionalImage" class="centeredContent" onload="resize();">
<div>
<?php
// $products_values->fields['products_image']
//Begin Image Handler changes 1 of 2
//the next line is commented out for Image Handler 3
if (file_exists($_GET['products_image_large_additional'])) {
//End Image Handler changes 1 of 2
echo '<a href="javascript:window.close()">' . zen_image($_GET['products_image_large_additional'], $products_values->fields['products_name'] . ' ' . TEXT_CLOSE_WINDOW) . '</a>';
//Begin Image Handler changes 2 of 2
//the next three lines are commented out for Image Handler 3
} else {
echo '<a href="javascript:window.close()">' . zen_image(DIR_WS_IMAGES . PRODUCTS_IMAGE_NO_IMAGE, POPUP_ADDITIONAL_NO_IMAGE . ' ' . TEXT_CLOSE_WINDOW) . '</a>'; /*v4.3.1c-lat9*/
}
//End Image Handler changes 2 of 2
?>
</div>
</body>
The above code does a check for the existence of the file on the server, and goes to present an image which if the image path is wrong/a non-image on the server, would not display anything as indicated by Dr. Byte if I understood correctly.
Re: Image Handler 4 (for v1.5.x) Support Thread
Quote:
Originally Posted by
mc12345678
Well, you probably should get some rest too. I saw you were awake a long time. :P
I was!!!! But first I gotta eat!!!
Re: Image Handler 4 (for v1.5.x) Support Thread
Awesome! @mc1234567 thank you for consolidating the current solution. I'll implement over the weekend.
Re: Image Handler 4 (for v1.5.x) Support Thread
Quote:
Originally Posted by
mydanilo
Awesome! @mc1234567 thank you for consolidating the current solution. I'll implement over the weekend.
Wasn't anything to "consolidate" really.. simply some changes that needed to be made to the additional_images.php file to work properly with the new
tpl_main_page.php popup code included in the current IH4 fileset.. and FYI, you need to include the fix to the popup code that torvista posted earlier..