Results 1 to 10 of 7098

Threaded View

  1. #11

    Idea or Suggestion Re: Image Handler 2 Support

    Hi Ryk,

    Thanks for the pointers. To keep things simple then, I have implemented a separate image popup for attribute images - which is probably more sensible than swapping the main product image.

    I have used a free, third-party script to generate smoother attribute images on demand rather than trying to hack into IH2. I am however running this alongside IH2 (which naturally brings other benefits) without any problems.

    Perhaps I need to package this up as a new contribution when it's tidied up?

    To make this work you'll need this script in your root directory:

    http://www.zubrag.com/scripts/thumbnail-generator.php

    You then need to modify the bottom of file /includes/functions/html_output.php as follows:

    // alt is added to the img tag even if it is null to prevent browsers from outputting
    // the image filename as default
    $image = '<img src="' . zen_output_string($src) . '" alt="' . zen_output_string($alt) . '"';

    if (zen_not_null($alt)) {
    $image .= ' title=" ' . zen_output_string($alt) . ' "';
    }

    if (zen_not_null($parameters)) $image .= ' ' . $parameters;

    $image .= ' />';

    return $image;
    }

    ?>


    ...becomes...

    // alt is added to the img tag even if it is null to prevent browsers from outputting
    // the image filename as default

    $image = '<img src="thumb.php?src=' . zen_output_string($src) . '&x=100&y=100&f=0" alt="' . zen_output_string($alt) . '"';

    if (zen_not_null($alt)) {
    $image .= ' title=" ' . zen_output_string($alt) . ' "';
    }

    if (zen_not_null($parameters)) $image .= ' ' . $parameters;

    $image .= ' onclick="popupWindow(\'http://YOURDOMAIN/index.php?main_page=popup_image&src='.zen_output_string($src).'\')"';

    $image .= ' />';

    return $image;
    }

    ?>

    Finally you need to modify the template which displays in the popup image window so that you can present any image you choose simply by providing the path in a new 'src' attribute:

    /includes/templates/YOUR_TEMPLATES/popup_image/tpl_main_page.php

    Change...

    <?php
    // $products_values->fields['products_image']
    echo '<a href="javascript:window.close()">' . zen_image($products_image_large, $products_values->fields['products_name'] . ' ' . TEXT_CLOSE_WINDOW) . '</a>';
    ?>
    </div>

    ...to...

    <?php
    if ($_GET['src']) {
    echo '<a href="javascript:window.close()"><img src="' . $_GET['src'] . '"></a>';
    } else {
    // $products_values->fields['products_image']
    echo '<a href="javascript:window.close()">' . zen_image($products_image_large, $products_values->fields['products_name'] . ' ' . TEXT_CLOSE_WINDOW) . '</a>';
    }
    ?>
    </div>

    This should now present any image you upload in the attributes controller as a server-side scaled image in your products pages and allow you to pop up the full size version in the standard popup image window.

    Feel free to test and advise.

    ColinR
    Last edited by colinr; 15 Nov 2006 at 02:09 AM.

 

 

Similar Threads

  1. v150 Image Handler 4 (for v1.5.x) Support Thread
    By DivaVocals in forum All Other Contributions/Addons
    Replies: 1687
    Last Post: 17 Nov 2024, 07:26 PM
  2. 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
  3. Image Handler Support Please
    By nadinesky in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 30 Sep 2013, 03:47 PM
  4. Image handler only covers part of screen
    By shaneburton in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 14 May 2009, 07:15 PM
  5. Is Image Handler the only way to go?
    By wwwursa in forum Installing on a Windows Server
    Replies: 2
    Last Post: 23 Dec 2007, 09:22 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