Results 1 to 10 of 1688

Threaded View

  1. #10
    Join Date
    Jul 2012
    Posts
    16,798
    Plugin Contributions
    17

    Default Re: Image Handler 4 (for v1.5.x) Support Thread

    Quote Originally Posted by DivaVocals View Post
    So I still don't know the fix, but I THINK I possibly have found the offending line that is causing the problem... (from includes/modules/YOUR_TEMPLATE/additional_images.php highlighted in red)

    Code:
    //  Begin Image Handler changes 1 of 2
    //next line is commented out for Image Handler
    //  $flag_has_large = file_exists($products_image_large);
        $flag_has_large = true;
    //  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(addslashes($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
    When I remove this IH line and un-comment the Zen Cart default, the popup works correctly, BUT it no longer pulls the image from the bmz_cache folder..
    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.

    There are changes that probably should be made to Zen Lightbox, which I have worked out some; however, that is to be carried on/over to the Zen Lightbox forum @ http://www.zen-cart.com/showthread.p...read&p=1215670. Something related to that may be posted in the next day or two as I have some prior commitments to engage in, so I apologize if it appears that I have abandoned the community on such an important issue.

    BTW, this is still code that is in development and is provided for review by others that might be able to chime in on the validity/security of it's use. Use at your own risk. Test locally before applying to a live server.
    Last edited by mc12345678; 23 Aug 2013 at 03:12 PM. Reason: Provide warning
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. v158 Image Handler 5 (for v1.5.5 - v1.5.8) Support Thread
    By lat9 in forum All Other Contributions/Addons
    Replies: 711
    Last Post: 10 May 2025, 02:13 PM
  2. Attribute image replaces main product image on select [Support Thread]
    By exoticcorpse in forum All Other Contributions/Addons
    Replies: 160
    Last Post: 28 Oct 2024, 10:50 PM
  3. v139h Image Handler 3 Support Thread (for ZC v1.3.9)
    By DivaVocals in forum All Other Contributions/Addons
    Replies: 1095
    Last Post: 2 Oct 2017, 12:42 PM
  4. v138a Image Handler 2 (for ZC v1.3.8 ONLY) Support
    By timkroeger in forum All Other Contributions/Addons
    Replies: 7098
    Last Post: 12 Oct 2014, 03:48 AM
  5. Image Handler Support Please
    By nadinesky in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 30 Sep 2013, 03:47 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR