Results 1 to 7 of 7
  1. #1

    Default Delay loading Additional Images

    Hello, everyone, I hope you can help me solve the problem of delaying loading detail pictures.
    I found that when the product with very little detail was loaded quickly, it was probably only 2-3s.
    But when there are dozens of detailed pictures, loading is slow, and more 10+s.

    This has a comparable connection

    many Additional Images
    a few Additional Images
    no additional images

    I passed the gtmetrix.com test and the same result.
    I now use the card product page, so it is appropriate for delaying loading details.
    So I hope that when customers need to look at the details of the picture and click on the "Additional Images" tab, the detail picture loading is basically completed or loaded, which does not affect the speed of the product page opening.

    Thanks

  2. #2
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,846
    Plugin Contributions
    25

    Default Re: Delay loading Additional Images

    Maybe you can try this lazy loader : https://github.com/DivaVocals/zen_ZenCartLazyLoader

  3. #3
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Delay loading Additional Images

    Also may consider image handler version 4 (compatible with ZC 1.5.4) so that the images presented on first load are applicably downsized (faster) and when displayed at click are more appropriately sized.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4

    red flag Re: Delay loading Additional Images

    Quote Originally Posted by Design75 View Post
    Maybe you can try this lazy loader : https://github.com/DivaVocals/zen_ZenCartLazyLoader
    First of all, thank you very much for your help.
    I just installed the plug-in step by step, but I didn't feel the speed rise. LOL, I don't know if it's an illusion or whether I installed it successfully.
    Please continue to check for me, thank you.

  5. #5

    Default Re: Delay loading Additional Images

    Quote Originally Posted by mc12345678 View Post
    Also may consider image handler version 4 (compatible with ZC 1.5.4) so that the images presented on first load are applicably downsized (faster) and when displayed at click are more appropriately sized.
    Thanks at first,i think i useing the image handler Version: 5.0.0-beta4 + zen light 1.7.0 now.
    And it don't defer Additional images?
    Thanks

  6. #6

    Default Re: Delay loading Additional Images

    Quote Originally Posted by Design75 View Post
    Maybe you can try this lazy loader : https://github.com/DivaVocals/zen_ZenCartLazyLoader
    And i used products per page option plug,my custom can choose the products number to display in per page,
    but after i used this lazy loader,the Categories products list page don't list images, and other products list page are working as new products/all products etc,so how to fix it?must delet the products per page plug?
    this is the products list.php:
    PHP Code:
    <?php
    /**
     * product_listing module
     *
     * @package modules
     * @copyright Copyright 2003-2007 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: product_listing.php 6787 2007-08-24 14:06:33Z drbyte $
     * UPDATED TO WORK WITH COLUMNAR PRODUCT LISTING For Zen Cart v1.3.6 - 10/25/2006
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die(
    'Illegal Access');
    }

    // BOF Number of Items Per Page
    if(isset($_POST['max_display']) || isset($_GET['max_display'])) {
    $_SESSION['product_listing_max_display'] = (int)$_REQUEST['max_display'];
    } elseif (!isset(
    $_SESSION['product_listing_max_display'])) {
    $_SESSION['product_listing_max_display'] = (int)MAX_DISPLAY_PRODUCTS_LISTING;
    }
    // EOF Number of Items Per Page

    // Column Layout Support originally added for Zen Cart v 1.1.4 by Eric Stamper - 02/14/2004
    // Upgraded to be compatible with Zen-cart v 1.2.0d by Rajeev Tandon - Aug 3, 2004
    // Column Layout Support (Grid Layout) upgraded for v1.3.0 compatibility DrByte 04/04/2006
    // Column Layout Support (Grid Layout) upgraded for v1.5.0 compatibility and changed to customer control asarfraz July 26 2012
    // Modified for admin control of customer option by Glenn Herbert (gjh42) 2012-09-20   test 20120929 grid sorter
    //
    if (!defined('PRODUCT_LISTING_LAYOUT_STYLE')) define('PRODUCT_LISTING_LAYOUT_STYLE',(isset($_GET['view']) ? $_GET['view'] : 'rows'));
    if (!
    defined('PRODUCT_LISTING_COLUMNS_PER_ROW')) define('PRODUCT_LISTING_COLUMNS_PER_ROW',3);
    if (!
    defined('PRODUCT_LISTING_GRID_SORT')) define('PRODUCT_LISTING_GRID_SORT',0);
    $product_listing_layout_style = isset($_GET['view'])? $_GET['view']: PRODUCT_LISTING_LAYOUT_STYLE;
    $row 0;
    $col 0;
    $list_box_contents = array();
    $title '';

    $max_results = (PRODUCT_LISTING_LAYOUT_STYLE=='columns' && PRODUCT_LISTING_COLUMNS_PER_ROW>0) ? (PRODUCT_LISTING_COLUMNS_PER_ROW * (int)($_SESSION['product_listing_max_display']/PRODUCT_LISTING_COLUMNS_PER_ROW)) : $_SESSION['product_listing_max_display'];


    $show_submit zen_run_normal();
    $listing_split = new splitPageResults($listing_sql$max_results'p.products_id''page');
    $zco_notifier->notify('NOTIFY_MODULE_PRODUCT_LISTING_RESULTCOUNT'$listing_split->number_of_rows);
    $how_many 0;

    // Begin Row Layout Header
    if ($product_listing_layout_style == 'rows' or PRODUCT_LISTING_GRID_SORT) {        // For Column Layout (Grid Layout) add on module

    $list_box_contents[0] = array('params' => 'class="productListing-rowheading"');

    $zc_col_count_description 0;
    $lc_align '';
    for (
    $col=0$n=sizeof($column_list); $col<$n$col++) {
      switch (
    $column_list[$col]) {
        case 
    'PRODUCT_LIST_MODEL':
        
    $lc_text TABLE_HEADING_MODEL;
        
    $lc_align '';
        
    $zc_col_count_description++;
        break;
        case 
    'PRODUCT_LIST_NAME':
        
    $lc_text TABLE_HEADING_PRODUCTS;
        
    $lc_align '';
        
    $zc_col_count_description++;
        break;
        case 
    'PRODUCT_LIST_MANUFACTURER':
        
    $lc_text TABLE_HEADING_MANUFACTURER;
        
    $lc_align '';
        
    $zc_col_count_description++;
        break;
        case 
    'PRODUCT_LIST_PRICE':
        
    $lc_text TABLE_HEADING_PRICE;
        
    $lc_align 'right' . (PRODUCTS_LIST_PRICE_WIDTH '" width="' PRODUCTS_LIST_PRICE_WIDTH '');
        
    $zc_col_count_description++;
        break;
        case 
    'PRODUCT_LIST_QUANTITY':
        
    $lc_text TABLE_HEADING_QUANTITY;
        
    $lc_align 'right';
        
    $zc_col_count_description++;
        break;
        case 
    'PRODUCT_LIST_WEIGHT':
        
    $lc_text TABLE_HEADING_WEIGHT;
        
    $lc_align 'right';
        
    $zc_col_count_description++;
        break;
        case 
    'PRODUCT_LIST_IMAGE':
        if (
    $product_listing_layout_style == 'rows') { //skip if grid
          
    $lc_text TABLE_HEADING_IMAGE;
          
    $lc_align 'center';
          
    $zc_col_count_description++;
        }
        break;
      }

      if ( (
    $column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {
        
    $lc_text zen_create_sort_heading($_GET['sort'], $col+1$lc_text);
      }



      
    $list_box_contents[0][$col] = array('align' => $lc_align,
                                          
    'params' => 'class="productListing-heading"',
                                          
    'text' => $lc_text );
    }

      if (
    $product_listing_layout_style == 'columns') { //grid sort option
        
    $grid_sort $list_box_contents[0];
        
    $list_box_contents = array();
      }
    // End Row Layout Header used in Column Layout (Grid Layout) add on module

    /////////////  HEADER ROW ABOVE /////////////////////////////////////////////////

    $num_products_count $listing_split->number_of_rows;

    if (
    $listing_split->number_of_rows 0) {
      
    $rows 0;
      
    // Used for Column Layout (Grid Layout) add on module
      
    $column 0;    
      if (
    $product_listing_layout_style == 'columns') {
        if (
    $num_products_count PRODUCT_LISTING_COLUMNS_PER_ROW || PRODUCT_LISTING_COLUMNS_PER_ROW == ) {
          
    $col_width floor(100/$num_products_count) - 0.5;
        } else {
          
    $col_width floor(100/PRODUCT_LISTING_COLUMNS_PER_ROW) - 0.5;
        }
      }
      
    // Used for Column Layout (Grid Layout) add on module


      
    $listing $db->Execute($listing_split->sql_query);
      
    $extra_row 0;
      while (!
    $listing->EOF) {

        if (
    $product_listing_layout_style == 'rows') { // Used in Column Layout (Grid Layout) Add on module
        
    $rows++;

        if (((
    $rows-$extra_row)/2) == floor(($rows-$extra_row)/2)) {
          
    $list_box_contents[$rows] = array('params' => 'class="productListing-even"');
        } else {
          
    $list_box_contents[$rows] = array('params' => 'class="productListing-odd"');
        }

        
    $cur_row sizeof($list_box_contents) - 1;
        }   
    // End of Conditional execution - only for row (regular style layout)

        
    $product_contents = array(); // Used For Column Layout (Grid Layout) Add on module

        
    for ($col=0$n=sizeof($column_list); $col<$n$col++) {
          
    $lc_align '';
          switch (
    $column_list[$col]) {
            case 
    'PRODUCT_LIST_MODEL':
            
    $lc_align '';
            
    $lc_text $listing->fields['products_model'];
            break;
            case 
    'PRODUCT_LIST_NAME':
            
    $lc_align '';
            if (isset(
    $_GET['manufacturers_id'])) {
              
    $lc_text '<h3 class="itemTitle"><a href="' zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > and $_GET['filter_id']) > ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' $listing->fields['products_id']) . '">' $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>' ;
            } else {
              
    $lc_text '<h3 class="itemTitle"><a href="' zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > and $_GET['filter_id']) > ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' $listing->fields['products_id']) . '">' $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
            }
            break;
            case 
    'PRODUCT_LIST_MANUFACTURER':
            
    $lc_align '';
            
    $lc_text '<a href="' zen_href_link(FILENAME_DEFAULT'manufacturers_id=' $listing->fields['manufacturers_id']) . '">' $listing->fields['manufacturers_name'] . '</a>';
            break;
    //bof As low as price// 
            
    case 'PRODUCT_LIST_PRICE'
             
                
    $lc_price zen_get_products_discount_price_qty((int)$listing->fields['products_id'],20000); 
                
    $lc_price '$'.number_format($lc_price2); 
                
    $lc_align 'right'
                if ( 
    zen_get_products_discount_price_qty((int)$listing->fields['products_id'],20000) != zen_get_products_actual_price((int)$listing->fields['products_id'])){ 
                                    
    //Change the next line to your own text/formatting requirements 
                    
    $lc_text='<span style="color: gray; font-weight: normal;">Price as low as:<br />' $lc_price ''
                    }else{ 
                    
    $lc_text =  $lc_price.'<br />'
                    } 
    //eof As low as prise//  

            // more info in place of buy now
            
    $lc_button '';
            if (
    zen_has_product_attributes($listing->fields['products_id']) or PRODUCT_LIST_PRICE_BUY_NOW == '0') {
              
    $lc_button '<a href="' zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > and $_GET['filter_id']) > ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > $_GET['cPath'] : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' $listing->fields['products_id']) . '">' MORE_INFO_TEXT '</a>';
            } else {
              if (
    PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0) {
                if (
                    
    // not a hide qty box product
                    
    $listing->fields['products_qty_box_status'] != &&
                    
    // product type can be added to cart
                    
    zen_get_products_allow_add_to_cart($listing->fields['products_id']) != 'N'
                    
    &&
                    
    // product is not call for price
                    
    $listing->fields['product_is_call'] == 0
                    
    &&
                    
    // product is in stock or customers may add it to cart anyway
                    
    ($listing->fields['products_quantity'] > || SHOW_PRODUCTS_SOLD_OUT_IMAGE == 0) ) {
                  
    $how_many++;
                }
                
    // hide quantity box
                
    if ($listing->fields['products_qty_box_status'] == 0) {
                  
    $lc_button '<a href="' zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' $listing->fields['products_id']) . '">' zen_image_button(BUTTON_IMAGE_BUY_NOWBUTTON_BUY_NOW_ALT'class="listingBuyNowButton"') . '</a>';
                } else {
                  
    $lc_button TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART "<input type=\"text\" name=\"products_id[" $listing->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
                }
              } else {
    // qty box with add to cart button
                
    if (PRODUCT_LIST_PRICE_BUY_NOW == '2' && $listing->fields['products_qty_box_status'] != 0) {
                  
    $lc_buttonzen_draw_form('cart_quantity'zen_href_link(zen_get_info_page($listing->fields['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' $listing->fields['products_id']), 'post''enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($listing->fields['products_id'])) . '" maxlength="6" size="4" /><br />' zen_draw_hidden_field('products_id'$listing->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CARTBUTTON_IN_CART_ALT) . '</form>';
                } else {
                  
    $lc_button '<a href="' zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' $listing->fields['products_id']) . '">' zen_image_button(BUTTON_IMAGE_BUY_NOWBUTTON_BUY_NOW_ALT'class="listingBuyNowButton"') . '</a>';
                }
              }
            }
            
    $the_button $lc_button;
            
    $products_link '<a href="' zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . ( ($_GET['manufacturers_id'] > and $_GET['filter_id']) > zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' $listing->fields['products_id']) . '">' MORE_INFO_TEXT '</a>';
            
    $lc_text .= '<br />' zen_get_buy_now_button($listing->fields['products_id'], $the_button$products_link) . '<br />' zen_get_products_quantity_min_units_display($listing->fields['products_id']);
            
    $lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON '<br />' '') : '');

            break;
            case 
    'PRODUCT_LIST_QUANTITY':
            
    $lc_align 'right';
            
    $lc_text $listing->fields['products_quantity'];
            break;
            case 
    'PRODUCT_LIST_WEIGHT':
            
    $lc_align 'right';
            
    $lc_text $listing->fields['products_weight'];
            break;
            case 
    'PRODUCT_LIST_IMAGE':
            
    $lc_align 'center';
            if (
    $listing->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) {
              
    $lc_text '';
            } else {
              if (isset(
    $_GET['manufacturers_id'])) {
                
    $lc_text '<a href="' zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > and $_GET['filter_id']) > ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' $listing->fields['products_id']) . '">' zen_image_lazy(DIR_WS_IMAGES $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTHIMAGE_PRODUCT_LISTING_HEIGHT'class="listingProductImage"') . '<noscript>' zen_image(DIR_WS_IMAGES $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTHIMAGE_PRODUCT_LISTING_HEIGHT'class="listingProductImage1"') . '</noscript>' '</a>'/*Lazy Loader change 1 of 2*/
              
    } else {
                
    $lc_text '<a href="' zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > and $_GET['filter_id']) > ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' $listing->fields['products_id']) . '">' zen_image_lazy(DIR_WS_IMAGES $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTHIMAGE_PRODUCT_LISTING_HEIGHT'class="listingProductImage"') . '<noscript>' zen_image(DIR_WS_IMAGES $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTHIMAGE_PRODUCT_LISTING_HEIGHT'class="listingProductImage1"') . '</noscript>' '</a>'/*Lazy Loader change 2 of 2*/
              
    }
            }
            break;
          }

          
    $product_contents[] = $lc_text// Used For Column Layout (Grid Layout) Option

          
    if ($product_listing_layout_style == 'rows') {
          
    $list_box_contents[$rows][$col] = array('align' => $lc_align,
                                                  
    'params' => 'class="productListing-data"',
                                                  
    'text'  => $lc_text);
        }
        }

        
    // add description and match alternating colors
        //if (PRODUCT_LIST_DESCRIPTION > 0) {
        //  $rows++;
        //  if ($extra_row == 1) {
        //    $list_box_description = "productListing-data-description-even";
        //    $extra_row=0;
        //  } else {
        //    $list_box_description = "productListing-data-description-odd";
        //    $extra_row=1;
        //  }
        //  $list_box_contents[$rows][] = array('params' => 'class="' . $list_box_description . '" colspan="' . $zc_col_count_description . '"',
        //  'text' => zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION));
        //}

        // Following code will be executed only if Column Layout (Grid Layout) option is chosen
        
    if ($product_listing_layout_style == 'columns') {
          
    $lc_text implode('<br />'$product_contents);
          
    $list_box_contents[$rows][$column] = array('params' => 'class="centerBoxContentsProducts centeredContent back"' ' ' 'style="width:' $col_width '%;"',
                                                     
    'text'  => $lc_text);
          
    $column ++;
          if (
    $column >= PRODUCT_LISTING_COLUMNS_PER_ROW) {
            
    $column 0;
            
    $rows ++;
          }
        }
        
    // End of Code fragment for Column Layout (Grid Layout) option in add on module
        
    $listing->MoveNext();
      }
      
    $error_categories false;
    } else {
      
    $list_box_contents = array();

      
    $list_box_contents[0] = array('params' => 'class="productListing-odd"');
      
    $list_box_contents[0][] = array('params' => 'class="productListing-data"',
                                                  
    'text' => TEXT_NO_PRODUCTS);

      
    $error_categories true;
    }

    if ((
    $how_many and $show_submit == true and $listing_split->number_of_rows 0) and (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART == or  PRODUCT_LISTING_MULTIPLE_ADD_TO_CART == 3) ) {
      
    $show_top_submit_button true;
    } else {
      
    $show_top_submit_button false;
    }
    if ((
    $how_many and $show_submit == true and $listing_split->number_of_rows 0) and (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART >= 2) ) {
      
    $show_bottom_submit_button true;
    } else {
      
    $show_bottom_submit_button false;
    }



      if (
    $how_many && PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != and $show_submit == true and $listing_split->number_of_rows 0) {
      
    // bof: multiple products
        
    echo zen_draw_form('multiple_products_cart_quantity'zen_href_link(FILENAME_DEFAULTzen_get_all_get_params(array('action')) . 'action=multiple_products_add_product'), 'post''enctype="multipart/form-data"');
      }

    ?>

  7. #7

    Default Re: Delay loading Additional Images

    Quote Originally Posted by Design75 View Post
    Maybe you can try this lazy loader : https://github.com/DivaVocals/zen_ZenCartLazyLoader
    I think i don't need to use lazy loader plug for products list,and only need it work for products_info page,so how to use it for there?
    And i hope the js only work for products_info page,and don't loading for other pages.
    below is my code:
    includes/modules/additional_images.php
    PHP Code:
    <?php
    /**mod Image Handler 4.1 and Zen_LightBox
     * additional_images module
     *
     * Prepares list of additional product images to be displayed in template
     *
     * @package templateSystem
     * @copyright Copyright 2003-2013 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 18697 2013-08-23 14:35:20Z wilt $
     */
    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_imagestrrpos($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_imagestrrpos($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_imagestrrpos($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($filestrrpos($file'.')) == $file_extension) {
              if(
    preg_match('/\Q' $products_image_base '\E/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 == ) {
        
    $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_IMAGESDIR_WS_IMAGES 'large/'$products_image_directory) . str_replace($products_image_extension''$file) . IMAGE_SUFFIX_LARGE $products_image_extension;
        
    // bof Zen Lightbox 2008-12-11 aclarke
    //next line is commented out for Image Handler
    //  $flag_has_large = file_exists($products_image_large);
        
    if (function_exists('handle_image')) {
            
    // bof Zen Lightbox 2013-08-24 mc12345678 
            
    $newimg handle_image($products_image_largeaddslashes($products_name), LARGE_IMAGE_WIDTHLARGE_IMAGE_HEIGHT,'');
            list(
    $src$alt$width$height$parameters) = $newimg
                
            
    $products_image_large zen_output_string($src);
            
    // eof Zen Lightbox 2013-08-24 mc12345678

        

        
    // eof Zen Lightbox 2008-12-11 aclarke
        
    $flag_has_large file_exists($products_image_large);

        
    $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_WIDTHSMALL_IMAGE_HEIGHT);
        
    // bof Zen Lightbox 2008-12-11 aclarke
        
    if (function_exists('handle_image')) {
        
    // remove additional single quotes from image attributes (important!)
        
    $thumb_slashes preg_replace("/([^\\\\])'/"'$1\\\''$thumb_slashes);
        }
        
    // eof Zen Lightbox 2008-12-11 aclarke
        
    $thumb_regular zen_image($base_image$products_nameSMALL_IMAGE_WIDTHSMALL_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 2008-12-11 aclarke
        
    if (ZEN_LIGHTBOX_STATUS == 'true') {
          if (
    ZEN_LIGHTBOX_GALLERY_MODE == 'true') {
            
    $rel 'lightbox-g';
          } else {
            
    $rel 'lightbox';
          }
        
    $script_link '<script language="javascript" type="text/javascript"><!--' "\n" 'document.write(\'' . ($flag_display_large '<a href="' zen_lightbox($products_image_largeaddslashes($products_name), LARGE_IMAGE_WIDTHLARGE_IMAGE_HEIGHT) . '" rel="' $rel '" title="' addslashes($products_name) . '">' $thumb_slashes '<br />' TEXT_CLICK_TO_ENLARGE '</a>' $thumb_slashes) . '\');' "\n" '//--></script>';
        } else {
        
    // eof Zen Lightbox 2008-12-11 aclarke
        
    $script_link '<script language="javascript" type="text/javascript"><!--' "\n" 'document.write(\'' . ($flag_display_large '<a href="javascript:popupWindow(\\\'' str_replace($products_image_largeurlencode(addslashes($products_image_large)), $large_link) . '\\\')">' $thumb_slashes '<br />' TEXT_CLICK_TO_ENLARGE '</a>' $thumb_slashes) . '\');' "\n" '//--></script>';
        
    // bof Zen Lightbox 2008-12-11 aclarke
        
    }
        
    // eof Zen Lightbox 2008-12-11 aclarke

        
    $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
    Last edited by targetmarts; 17 May 2018 at 03:23 AM.

 

 

Similar Threads

  1. v139h Problems loading admin pages and product additional images -Please help!
    By nickorett in forum General Questions
    Replies: 1
    Last Post: 29 Jul 2012, 09:52 PM
  2. Loading delay hourglass
    By irishshopper in forum Basic Configuration
    Replies: 3
    Last Post: 6 Jul 2011, 05:39 PM
  3. ZenLightBox & Image Handler II - Additional images not loading!...
    By J9MM0 in forum All Other Contributions/Addons
    Replies: 8
    Last Post: 17 May 2011, 04:23 PM
  4. Additional Images not loading in IE
    By Jeffries Productions in forum General Questions
    Replies: 3
    Last Post: 25 Sep 2009, 04:33 PM
  5. Serious Delay Loading Pages
    By marke in forum Basic Configuration
    Replies: 39
    Last Post: 17 Oct 2006, 11:42 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