Page 5 of 5 FirstFirst ... 345
Results 41 to 48 of 48
  1. #41
    Join Date
    Oct 2007
    Posts
    241
    Plugin Contributions
    0

    Default Re: Multiple Images for One Listing Questions

    Quote Originally Posted by gjh42 View Post
    The product base image (in /images/ or /images/your_subdir/) is the thumbnail: the smallest sized image.
    You don't want additional images at thumbnail size, ever - that's what all the work is about, to get medium-sized additional images on the product info page.
    OK, that's what i thought, as the file in /images/ is the lowest-res (product listing thumbnail-sized)

    So the additional files w/o the suffix _MED and _LRG should be unnecessary if I am seeking medium-sized additional images....OK..makes sense... [/QUOTE]

    Quote Originally Posted by gjh42 View Post
    The stock ZC code requires a thumbnail-sized image for every product image, main or additional. My mods change that to requiring a medium-sized image for the additional images, and a large image if desired.
    $products_image_match_array = array();

    OK, thanks....this seems right on target! : )
    -----------------------
    Quote Originally Posted by gjh42 View Post
    We have both spent a lot of time trying to describe what we think code may or may not do; it would save a lot of energy if you try the code and see what it does. If it doesn't work, I'll troubleshoot it. Save a copy of the original file.
    OK...I've been doing that...before I started all this I saved the default additional images.php file. I have a few variations I've tried since, just playing around.

    Ill give this a try and report back my results.

    have a good weekend.

  2. #42
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Multiple Images for One Listing Questions

    Here is the complete modified additional_images.php:
    PHP Code:
    <?php
    /**
     * additional_images module
     *
     * Prepares list of additional product images to be displayed in template
     *
     * @package templateSystem
     * @copyright Copyright 2003-2006 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 5369 2006-12-23 10:55:52Z drbyte $ 
     * Modified to use medium-sized additional images by gjh42 20071026
     */
    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();

    if (
    $products_image != '') {
      
    // 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 != '') { //med add: product is in a subdir - insert medium/ into dir path
        
    $products_image_directory DIR_WS_IMAGES str_replace($products_image_directory''$products_image) . "/";
        
    $products_image_directory_medium DIR_WS_IMAGES 'medium/' str_replace($products_image_directory''$products_image) . "/";
      } else { 
    //med add: product is in /images/ - insert medium/ into dir path
        
    $products_image_directory DIR_WS_IMAGES;
        
    $products_image_directory_medium DIR_WS_IMAGES 'medium/';
      }

      
    // Check for additional matching images
      
    $file_extension $products_image_extension;
      
    $products_image_match_array = array();
      if (
    $dir = @dir($products_image_directory_medium)) { //med add: if med is valid dir
        
    while ($file $dir->read()) {
          if (!
    is_dir($products_image_directory_medium $file)) { //med add: if item being read is file, not subdir
            
    if (substr($filestrrpos($file'.')) == $file_extension) {
              
    //          if(preg_match("/" . $products_image_match . "/i", $file) == '1') {
              
    if(preg_match("/" $products_image_base "/i"$file) == '1') {
                if (
    $file != (str_replace($products_image_extension''$products_image) . IMAGE_SUFFIX_MEDIUM $products_image_extension)) { //med add: check against main med img, not main thumb
                  
    if ($products_image_base str_replace($products_image_base''$file) == $file) {//med add: filename must not have _MED suffix
                    //if (substr($file, strrpos($file, IMAGE_SUFFIX_MEDIUM)) == IMAGE_SUFFIX_MEDIUM . $file_extension) { //med add: if filename ends in _MED
                    //  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;
        
    $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_medium $file//med add: use med dir
        
    $thumb_slashes zen_image($base_imageaddslashes($products_name), MEDIUM_IMAGE_WIDTHMEDIUM_IMAGE_HEIGHT); //med add: medium w & h
        
    $thumb_regular zen_image($base_image$products_nameMEDIUM_IMAGE_WIDTHMEDIUM_IMAGE_HEIGHT); //med add: medium w & h
        
    $large_link zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL'pID=' $_GET['products_id'] . '&pic=' $i '&products_image_large_additional=' $products_image_large);

        
    // Link Preparation:
        
    $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>';

        
    $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

    ?>

  3. #43
    Join Date
    Oct 2007
    Posts
    241
    Plugin Contributions
    0

    Default Re: Multiple Images for One Listing Questions

    Quote Originally Posted by gjh42 View Post
    Here is the complete modified additional_images.php:[php]
    <?php
    /**
    * additional_images module
    *
    * Prepares list of additional product images to be displayed in template
    *
    * @package templateSystem
    * @copyright Copyright 2003-2006 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 5369 2006-12-23 10:55:52Z drbyte $
    * Modified to use medium-sized additional images by gjh42 20071026
    */
    OK.......I installed this additional_images.php file.

    The correct additional images seem to appear in _MED size.

    So far, everything seems to work OK. I will play around with this a bit and tell you what happens.

    BTW, you all have been really helpful!

    THANK YOU KINDLY!!!!!!!!!!!!!!!

  4. #44
    Join Date
    Oct 2007
    Posts
    241
    Plugin Contributions
    0

    Default Re: Multiple Images for One Listing Questions

    Ok...I tested this with the images in the /images/ dir. All additonal images displayed, correct _MED files, in medium size.


    When I put set the product to find the images in the /images/subdir/ with all the same associated files...

    Additional images NO LONGER display!!!

    I plan to use subfolders, so this will be an issue.

    --------------

    ALSO...

    When I set the product image back to /images/image.jpg and associated files (as I had it in my first test), there is no 'click for larger' link even if larger images ARE present (in the /large/ dir, without using any subdir).

    I had made a modification that checks whether a large image is there or not, and then displays,or doesn't display the link. The mod was provided in thread Additional_Images.php Line 16-display link if no large


    Thanks!
    Last edited by Donn; 30 Oct 2007 at 03:27 AM.

  5. #45
    Join Date
    Oct 2007
    Posts
    241
    Plugin Contributions
    0

    Default Re: Multiple Images for One Listing Questions

    Quote Originally Posted by Donn View Post
    Ok...I tested this with the images in the /images/ dir. All additonal images displayed, correct _MED files, in medium size.


    When I put set the product to find the images in the /images/subdir/ with all the same associated files...

    Additional images NO LONGER display!!!
    Note: I didn't explain that I did, in fact, have the _MED and _LRG files in the associated
    medium/subdir and large/subdir. I realize I was unclear and that missing files and/or subdirs , of course, could create the same issue of no additional photos.

    Just trying to be clear........!

  6. #46
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Multiple Images for One Listing Questions

    I'll take a closer look at this when I get time tomorrow night. I can install it in my local test ZC to see what happens with this mod and nothing else.

    "I had made a modification that checks whether a large image is there or not, and then displays,or doesn't display the link. The mod was provided in thread Additional_Images.php Line 16-display link if no large"

    I think this would never find the medium and/or large additional image files correctly, so would always disable the larger image link...
    Last edited by gjh42; 30 Oct 2007 at 09:10 AM.

  7. #47
    Join Date
    Oct 2007
    Posts
    241
    Plugin Contributions
    0

    Default Re: Multiple Images for One Listing Questions

    Quote Originally Posted by gjh42 View Post
    I'll take a closer look at this when I get time tomorrow night. I can install it in my local test ZC to see what happens with this mod and nothing else.

    "I had made a modification that checks whether a large image is there or not, and then displays,or doesn't display the link. The mod was provided in thread Additional_Images.php Line 16-display link if no large"

    I think this would never find the medium and/or large additional image files correctly, so would always disable the larger image link...
    The script change I quoted in post 'Additional_Images.php Line 16' does, in fact, work at finding the large photos if they are there, and keeps the link from displaying if not present.

    Did you happen to have a chance to look at the problem of medium additional images again? For now, I've just set everything to default.

    Thanks...

  8. #48
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Multiple Images for One Listing Questions

    I wish the forum had a way to mark posts as unread, so it would be easier to remember threads you wanted to get back to...
    I'm heading out of town, but will check on it when I return (note written to myself:).

 

 
Page 5 of 5 FirstFirst ... 345

Similar Threads

  1. How can I add multiple images for ONE product through the Admin page?
    By stevewag in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 20 Apr 2009, 09:57 AM
  2. Multiple images for one item ? ? ?
    By ve39 in forum General Questions
    Replies: 7
    Last Post: 22 Oct 2008, 06:56 AM
  3. Questions about emailing multiple customers at one time
    By BouncerFL in forum General Questions
    Replies: 0
    Last Post: 1 Apr 2008, 05:57 PM
  4. Multiple Images Questions
    By manifest in forum Templates, Stylesheets, Page Layout
    Replies: 12
    Last Post: 3 Mar 2008, 10:44 PM
  5. Stock control - listing multiple items as one
    By chmac in forum General Questions
    Replies: 3
    Last Post: 10 Sep 2007, 01:51 PM

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