Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Jul 2009
    Posts
    19
    Plugin Contributions
    0

    Default Main image along side thumbnails

    hi all,

    I've been searching around for the answer to this for a while but cant find what i need. For every product on my site i have 4 images, main image and 3 additionals, i would like to be able to have all 4 images show under the mail image as thumbnails instead of just the 3 additional images. I have the jqueryzoom installed with the image swap and dont like how it swaps the main image with the thumnail.

    i would imagin i need the aditional_images.php (this comes with the jqzoom package) to get the main image as well as the aditional.

    here is the aditional_images.php file.

    any help would be great. thanks
    Code:
    <?php
    /**
     * additional_images module
     *
     * Prepares list of additional product images to be displayed in template
     *
     * @package templateSystem
     * @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: additional_images.php 6132 2007-04-08 06:58:40Z drbyte $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die('Illegal Access');
    }
    
    if(!defined('LARGE_IMAGE_MAX_WIDTH'))
    	define('LARGE_IMAGE_MAX_WIDTH', MEDIUM_IMAGE_WIDTH);
    	
    if(!defined('LARGE_IMAGE_MAX_HEIGHT'))
    	define('LARGE_IMAGE_MAX_HEIGHT', MEDIUM_IMAGE_HEIGHT);
    	
    if (!defined('IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE')) define('IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE','Yes');
    $images_array = array();
    
    if ($products_image != '') {
      // 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_match . "/i", $file) == '1') {
              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;
        if(defined(IH_RESIZE))
        	$flag_has_large = true;//file_exists($products_image_large);
        else
        $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);
        // remove additional single quotes from image attributes (important!)
        $thumb_slashes = preg_replace("/([^\\\\])'/", '$1\\\'', $thumb_slashes);
        $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 jqzoom + jqlightbox
        if(JQZOOM_STATUS == 'true' || JQLIGHTBOX_STATUS == 'true'){
        	$css_class = '';
        	if(JQZOOM_STATUS == 'true')
        		$css_class = 'jqzoomAdditional';
        	if(JQLIGHTBOX_STATUS == 'true')
        		$css_class .= ' jqlightbox';
        	$css_class = trim($css_class);
        $script_link = '<script language="javascript" type="text/javascript"><!--' . "\n" . 'document.write(\'' . '<a href="'. zen_lightbox($products_image_large, addslashes($products_name), LARGE_IMAGE_MAX_WIDTH, LARGE_IMAGE_MAX_HEIGHT) . '" class="'.$css_class.'">' . $thumb_slashes . '</a>\')'. "\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 jqzoom + jqlightbox
        
        $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

  2. #2
    Join Date
    Jul 2009
    Posts
    19
    Plugin Contributions
    0

    Default Re: Main image along side thumbnails

    any help would be really good

 

 

Similar Threads

  1. RRP Along side product price?
    By NathanielB in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 21 Oct 2011, 08:57 AM
  2. Making text flow along side Image on main page
    By Fhurley in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 6 Oct 2009, 04:45 AM
  3. display an image along with text in main page
    By JohnBoyCR in forum General Questions
    Replies: 1
    Last Post: 18 Jan 2009, 09:22 PM
  4. Image each side of main header image
    By butchx5 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 9 Jan 2009, 02:36 PM
  5. Thumbnails are not side by side
    By tatiana77 in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 19 Aug 2007, 02:06 AM

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