[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 image_handler.php

Zen Cart 源代码 image_handler.php




下载文件

文件名: image_handler.php
文件类型: PHP文件
文件大小: 55.18 KiB
MD5: 2d4a38cec45ff95405af3d0dedc299b8

image_handler.php - 关闭高亮
  1. <?php
  2. /**
  3.  * image_handler.php
  4.  * IH 4.3.2 admin interface
  5.  *
  6.  * @author  Tim Kroeger (original author)
  7.  * @copyright Copyright 2005-2006
  8.  * @license http://www.gnu.org/licenses/gpl.txt GNU General Public License V2.0
  9.  * @version $Id: image_handler.php,v 2.0 Rev 8 2010-05-31 23:46:5 DerManoMann Exp $
  10.  * DerManoMann 2010-05-31 23:46:50
  11.  * Nigelt74 2012-02-18
  12.  * torvista 2012-04-14  
  13.  */
  14.  
  15.   require('includes/application_top.php');
  16.   require(DIR_WS_CLASSES . 'currencies.php');
  17.   require_once(DIR_FS_CATALOG . DIR_WS_CLASSES . 'bmz_image_handler.class.php');
  18.  
  19.   define('HEADING_TITLE', IH_HEADING_TITLE);
  20.   define('HEADING_TITLE_PRODUCT_SELECT', IH_HEADING_TITLE_PRODUCT_SELECT);
  21.  
  22.   global $messageStack;
  23.   $page = isset($_GET['page']) ? $_GET['page'] : ((!defined('IH_VERSION') || (IH_VERSION == 'REMOVED')) ? 'admin' : 'manager');
  24.   //$action = (isset($_GET['action']) ? $_GET['action'] : '');
  25.   //------- Nigel
  26.   if (isset($_POST['action'])) { $action = $_POST['action'];
  27.     } elseif (isset($_GET['action'])) {
  28.     $action = $_GET['action'];
  29.     }
  30. //-------End Nigel
  31. //  $action = (isset($_GET['action']) ? $_GET['action'] : '');
  32.   $products_filter = (isset($_GET['products_filter']) ? $_GET['products_filter'] : '');
  33.   $current_category_id = (isset($_GET['current_category_id']) ? $_GET['current_category_id'] : $current_category_id);
  34.   $currencies = new currencies();
  35.   $import_info = null;
  36.  
  37.   function get_image_details_string( $filename ) {
  38.  
  39.     if (!file_exists( $filename )) {
  40.       return "no info";
  41.     }
  42.     $str = "";
  43.     // find out some details about the file
  44.     $image_size = @getimagesize($filename);
  45.     $image_fs_size = filesize($filename);
  46.  
  47.     $str .= $image_size[0]."x".$image_size[1];
  48.     $str .= "<br /><strong>". round($image_fs_size/1024, 2) . "Kb</strong>";
  49.    
  50.     return $str;
  51.   }
  52.  
  53.   //
  54.   // Search the base directory and find additional images
  55.   //
  56.   function find_additional_images(&$array, $directory, $extension, $base ) {
  57.  
  58.     $image = $base . $extension;
  59.  
  60.     // Check for additional matching images
  61.     if ($dir = @dir($directory)) {
  62.       while ($file = $dir->read()) {
  63.         if (!is_dir($directory . $file)) {
  64.           if(preg_match("/^" . $base . "/i", $file) == '1') {
  65.             // echo "BASE: ".$base.' FILE: '.$file.'<br />';
  66.             if (substr($file, 0, strrpos($file, '.')) != substr($image, 0, strrpos($image, '.'))) {
  67.               if ($base . preg_replace("/^$base/", '', $file) == $file) {
  68.                 $array[] = $file;
  69.                 // echo 'I AM A MATCH ' . $products_image_directory . '/'.$file . $products_image_extension .'<br />';
  70.               } else {
  71.                 // echo 'I AM NOT A MATCH ' . $file . '<br />';
  72.               }
  73.             }
  74.           }
  75.         }
  76.       }
  77.      
  78.       if (sizeof($array) > 1) {
  79.         sort($array);
  80.       }
  81.      
  82.       $dir->close();
  83.      
  84.       return 1;
  85.     }
  86.    
  87.     return 0;
  88.   }
  89.  
  90.   function find_original_image($src) {
  91.     global $ihConf;
  92.     // try to find file by using different file extensions if initial
  93.     // source doesn't succeed
  94.     $imageroot = $ihConf['dir']['docroot'] . $ihConf['dir']['images'] . 'original/';
  95.     if (is_file($imageroot . $src)) {
  96.       return 'original/' . $src;
  97.     } else {
  98.       // do a quick search for files with common extensions
  99.       $extensions = array('.png', '.PNG', '.jpg', '.JPG', '.jpeg', '.JPEG', '.gif', '.GIF');
  100.       $base = substr($src, 0, strrpos($src, '.'));
  101.       for ($i=0; $i<count($extensions); $i++) {
  102.         if (is_file($imageroot . $base . $extensions[$i])) {
  103.           return 'original/' . $base . $extensions[$i];
  104.         }
  105.       }
  106.       // not found? maybe mixed case file extension?
  107.       if ($ihConf['allow_mixed_case_ext']) {
  108.         // this can cost some time for every displayed image so default is
  109.         // to not do this search
  110.         $directory = dirname($imageroot . $src);
  111.         $dir = @dir($directory);
  112.         while ($file = $dir->read()) {
  113.           if (!is_dir($directory . $file)) {
  114.             if(preg_match("/^" . $imageroot . $base . "/i", $file) == '1') {
  115.               $file_ext = substr($file, strrpos($file, '.'));
  116.               if (is_file($imageroot . $base . $file_ext)) {
  117.                 return 'original/' . $base . $file_ext;
  118.               }
  119.             }
  120.           }
  121.         }
  122.       }
  123.     }
  124.     // still here? no file found...
  125.     return false;
  126.   }
  127.  
  128.   function get_import_info() {
  129.     global $db;
  130.     $products = $db->Execute("select products_id, products_image from " . TABLE_PRODUCTS . " where products_image != '' order by products_image asc");
  131.     $previous_image = '';
  132.     $info = array();
  133.     $index = 0;
  134.     $previous_image = '';
  135.     while (!$products->EOF){
  136.       $image = $products->fields['products_image'];
  137.       if ($image != $previous_image) {
  138.         $previous_image = $image;
  139.         $original_image = find_original_image($image);
  140.         if ($original_image) {
  141.           $info[$index]['source'] = $image;
  142.           $info[$index]['original'] = $original_image;
  143.           $info[$index]['target'] = preg_replace('/^original\//', '', $original_image);
  144.           $index++;  
  145.         }
  146.       }
  147.       $products->MoveNext();
  148.     }
  149.     return $info;
  150.   }
  151.  
  152.  
  153.   if ($action == 'set_products_filter') {  
  154.     $_GET['products_filter'] = $_POST['products_filter'];
  155.     zen_redirect(zen_href_link(FILENAME_IMAGE_HANDLER, 'page=manager&amp;products_filter=' . $_GET['products_filter']));
  156.   }
  157.  
  158.   if ($page == 'manager') {
  159.     // manager actions are handled in a seperate file
  160.     require('includes/ih_manager.php');
  161.   }
  162.  
  163.  
  164.  
  165.  
  166.    if ($action == 'ih_remove') {
  167.     $uninstall = 'uninstall';
  168.     $message_type = 'session';
  169.     require_once('includes/init_includes/init_image_handler.php');
  170.         zen_redirect(zen_href_link(FILENAME_CONFIGURATION, 'gID=4'));
  171.    }
  172.  
  173.  
  174.   if ($action == 'ih_import_images') {
  175.     $files = get_import_info();
  176.     $previous_image = '';
  177.     $imageroot = $ihConf['dir']['docroot'] . $ihConf['dir']['images'];
  178.     if (count($files) > 0) {
  179.       for ($i = 0; $i < count($files); $i++) {
  180.         // Remove destination file if it's there
  181.         @unlink($imageroot . $files[$i]['target']);
  182.         if (rename($imageroot . $files[$i]['original'], $imageroot . $files[$i]['target'])) {
  183.           // Update database
  184.           if ($files[$i]['target'] != $files[$i]['source']) {
  185.             $db->Execute("update " . TABLE_PRODUCTS . " set products_image='" . $files[$i]['target'] . "' where products_image='" . $files[$i]['source'] . "'");
  186.           }
  187.           @unlink($imageroot . $files[$i]['source']);
  188.           $messageStack->add(TEXT_MSG_IMPORT_SUCCESS . $files[$i]['original'] . ' => ' . $files[$i]['target'], 'success');
  189.         } else {
  190.           $messageStack->add(TEXT_MSG_IMPORT_FAILURE . $files[$i]['original'] . ' => ' . $files[$i]['target'], 'error');
  191.         }
  192.       }
  193.       $messageStack->add(IH_IMAGES_IMPORTED, 'success');
  194.     }
  195.   }
  196.  
  197.   if ($action == 'ih_scan_originals') {
  198.     $import_info = get_import_info();
  199.     if (count($import_info) <= 0) {
  200.       $messageStack->add(IH_NO_ORIGINALS, 'caution');
  201.     }
  202.   }  
  203.  
  204.   if ($action == 'ih_clear_cache') {
  205.     $error = bmz_clear_cache();
  206.     if (!$error) {
  207.       $messageStack->add(IH_CACHE_CLEARED, 'success');
  208.     }
  209.   }
  210.  
  211.  
  212.  
  213. ?>
  214. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  215. <!--doctype changed to stop quirks mode -->
  216. <html <?php echo HTML_PARAMS; ?>>
  217. <head>
  218. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  219. <title><?php echo TITLE . ' - '. ICON_IMAGE_HANDLER; ?></title>
  220. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  221. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  222. <script language="javascript" type="text/javascript" src="includes/menu.js"></script>
  223. <script language="javascript" type="text/javascript" src="includes/general.js"></script>
  224. <link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
  225. <script language="javascript" type="text/javascript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
  226.  
  227. <script type="text/javascript">
  228.   <!--
  229.   function init()
  230.   {
  231.     cssjsmenu('navbar');
  232.     if (document.getElementById)
  233.     {
  234.       var kill = document.getElementById('hoverJS');
  235.       kill.disabled = true;
  236.     }
  237.   }
  238.  
  239.    function popupWindow(url) {
  240.         window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=600,height=460,screenX=150,screenY=150,top=150,left=150')
  241.     }
  242.  
  243.   // -->
  244. </script>
  245. <style type="text/css">
  246.   /* general headline setup */
  247.   h1, h2, h3, h4, h5 {
  248.      color: #000000;
  249.      /*font-family: Georgia,"Times New Roman",serif;*/
  250.      font-weight: bold;
  251.      letter-spacing: 0.1em;
  252.      word-spacing: 0.2em;
  253.      margin: 0 0 0 0;
  254.      padding: 0 0 0 0;
  255.      clear: left
  256.   }
  257.  
  258.   .logo h1 {margin: 0; padding: 11px 0 0 0; font-size: 30px; color:#CCCCCC}
  259.   h1 {font-size: 180%}
  260.   h2 {font-size: 160%}
  261.   h3 {font-size: 140%}
  262.   h4 {font-size: 120%}
  263.   h5 {font-size: 100%}
  264.  
  265.   h1 a, h2 a, h3 a, h4 a, h5 a {
  266.      font-weight: bold;
  267.      letter-spacing: 0.1em;
  268.      word-spacing: 0.2em;
  269.   }
  270.  
  271.   input[type="text"], input[type="submit"], input[type="file"], select {
  272.     border: 1px solid #CCCCCC;
  273.     background-color: #FFFFFF;
  274.   }
  275.  
  276.   div.adminbox {
  277.     padding: 10px;
  278.   }
  279.  
  280.   div.aboutbox {
  281.     /*margin: 0 auto;*/
  282.   width: 95%;
  283.     /*text-align:center;*/
  284.   }
  285.  
  286.   .aboutbox p {
  287.     text-align: justify;
  288.   }
  289.  
  290.  
  291. fieldset {
  292.     background: #f6f6f8;
  293.     padding: 0.5em 0.5em 0.5em 0.5em;
  294.     margin: 0 0 1em 0;
  295.     border: 1px solid #ccc;
  296. }
  297.  
  298. legend {
  299.     /*font-family : arial, helvetica, sans-serif;*/
  300.     font-weight: bold;
  301.     font-size: 1.4em;
  302.     color: #1240b0;
  303. }
  304.  
  305.  
  306.   div.managerbox {
  307.     clear: both;
  308.   }
  309.  
  310.   div.donationbox {
  311.     display: none;
  312.   }
  313.  
  314.   .donationbox label {
  315.     display: none;
  316.   }
  317.  
  318.   .donationbox input[type=text], .donationbox input[type=submit], .donationbox select {
  319.     display: none;
  320.   }
  321.  
  322.   .donationbox input[type=submit] {margin-bottom: 5px; cursor: pointer}
  323.  
  324.   .donationbox h2 {
  325.     font-size: 100%;
  326.   }
  327.  
  328.   a.wikilink1:link    { color:#009900; text-decoration:none }
  329.   a.wikilink1:visited { color:#009900; text-decoration:none }
  330.   a.wikilink1:hover   { color:#009900; text-decoration:underline }
  331.  
  332.  
  333.  
  334. </style>
  335.  
  336.  
  337. </head>
  338. <body onLoad="init()">
  339. <div id="spiffycalendar" class="text"></div>
  340. <!-- header //-->
  341. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  342. <!-- header_eof //-->
  343.  
  344. <!-- body //-->
  345.  
  346. <div>
  347.  
  348. <div style="float:left; padding: 8px 5px;">
  349. <h1><?php echo HEADING_TITLE; ?></h1>
  350. <?php
  351. if (defined('IH_VERSION')) {
  352.     echo IH_VERSION_VERSION . ':&nbsp;' . IH_VERSION . '<br />';
  353. } else {
  354.     echo IH_VERSION_NOT_FOUND . '<br />';
  355. }
  356. ?>
  357. </div>
  358.  
  359. <?php
  360. if ($page == 'manager') {
  361. // SEARCH DIALOG BOX
  362.   echo '<div style="float:right; padding: 5px;">';
  363.   echo zen_draw_form('search', FILENAME_CATEGORIES, '', 'get');
  364. // show reset search
  365.   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
  366.     echo '<a href="' . zen_href_link(FILENAME_CATEGORIES) . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a>&nbsp;&nbsp;';
  367.   }
  368.   echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search');
  369.   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
  370.     $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
  371.     echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords;
  372.   }
  373.   echo '</form>';
  374.   echo '</div>';
  375. }
  376. ?>
  377. </div>
  378.  
  379. <div style="clear:both"></div>
  380.  
  381. <ul style="background-color:#F5F5F5; border: solid #CCCCCC; border-width: 1px 0px;">
  382.   <li style="display:inline; padding:2px 5px; <?php echo ($page == 'manager') ? 'background:#CCCCCC;' : ''; ?>">
  383.     <a href="<?php echo zen_href_link(FILENAME_IMAGE_HANDLER, 'page=manager') ?>"><?php echo IH_MENU_MANAGER; ?></a>
  384.   </li>
  385.   <li style="display:inline; padding:2px 5px; <?php echo ($page == 'admin') ? 'background:#CCCCCC;' : ''; ?>">
  386.      <a href="<?php echo zen_href_link(FILENAME_IMAGE_HANDLER, 'page=admin') ?>"><?php echo IH_MENU_ADMIN; ?></a>
  387.   </li>
  388.   <li style="display:inline; padding:2px 5px; <?php echo ($page == 'preview') ? 'background:#CCCCCC;' : ''; ?>">
  389.     <a href="<?php echo zen_href_link(FILENAME_IMAGE_HANDLER, 'page=preview') ?>"><?php echo IH_MENU_PREVIEW; ?></a>
  390.   </li>
  391.   <li style="display:inline; padding:2px 5px; <?php echo ($page == 'about') ? 'background:#CCCCCC;' : ''; ?>">
  392.     <a href="<?php echo zen_href_link(FILENAME_IMAGE_HANDLER, 'page=about') ?>"><?php echo IH_MENU_ABOUT; ?></a>
  393.   </li>
  394. </ul>
  395.  
  396. <div class="adminbox">
  397. <?php
  398.  
  399.  
  400.  
  401. /**
  402.  * ADMIN TABPAGE INITIALIZATION
  403.  */
  404. $ih_admin_actions = array();
  405. $page = isset($_GET['page']) ? $_GET['page'] : ((!defined('IH_VERSION') || (IH_VERSION == 'REMOVED')) ? 'admin' : 'manager');
  406. if ($page == 'admin') {
  407.     $ih_admin_actions['ih_confirm_remove'] = IH_REMOVE;
  408.     $ih_admin_actions['ih_clear_cache'] = IH_CLEAR_CACHE;
  409.     $ih_admin_actions['ih_scan_originals'] = IH_SCAN_FOR_ORIGINALS;
  410. }
  411.  
  412.  
  413.  
  414.  
  415. /**
  416.  * image handler uninstall confirmation
  417.  */
  418.  
  419. if ($action == 'ih_confirm_remove') {
  420.   echo zen_draw_form('remove_form', FILENAME_IMAGE_HANDLER, '', 'get');
  421.   echo zen_draw_hidden_field('action', 'ih_remove');
  422.   echo IH_CONFIRM_REMOVE . '&nbsp;';
  423.   echo zen_image_submit('button_delete.gif', IMAGE_DELETE);
  424.   echo '</form>';
  425. }
  426.  
  427. if ($action == 'ih_scan_originals') {
  428.   if (count($import_info) > 0) {
  429.     echo zen_draw_form('import_form', FILENAME_IMAGE_HANDLER, '', 'get');
  430.     echo zen_draw_hidden_field('action', 'ih_import_images');
  431.     echo IH_CONFIRM_IMPORT . '<br />';
  432.     echo zen_image_submit('button_confirm.gif', IMAGE_CONFIRM) . '<br /><br />';
  433.     for ($i = 0; $i < count($import_info); $i++) {
  434.       echo "#$i: " . $import_info[$i]['original'] . ' => ' . $import_info[$i]['target'] . '<br /><br />';
  435.     }
  436.     echo '<br /><br />' . IH_CONFIRM_IMPORT . '<br />';
  437.     echo zen_image_submit('button_confirm.gif', IMAGE_CONFIRM) . '<br />';
  438.     echo '</form>';
  439.   }
  440. }
  441.  
  442. if (count($ih_admin_actions) > 0) {
  443.     echo '<ul>';
  444.     foreach ($ih_admin_actions as $action_name => $link_name) {
  445.         echo '<li><a href="' . zen_href_link(FILENAME_IMAGE_HANDLER, 'page=admin&amp;action=' . $action_name) . '">' . $link_name . '</a></li>';
  446.     }
  447.     echo '</ul>';
  448. }
  449.  
  450.  
  451.  
  452.  
  453. /**
  454.  * MANAGER TABPAGE
  455.  */
  456.  
  457. if ($page == 'manager') {
  458.   $curr_page = FILENAME_IMAGE_HANDLER;
  459. echo '<table summary="Products Previous Next Display">';
  460.     require(DIR_WS_MODULES . FILENAME_PREV_NEXT_DISPLAY);
  461. echo '</table>';   
  462. ?>
  463.  
  464.          
  465.          <?php echo zen_draw_form('set_products_filter_id', FILENAME_IMAGE_HANDLER, 'action=set_products_filter', 'post'); ?>
  466. <!--    
  467.       <?php echo zen_draw_hidden_field('products_filter', $_GET['products_filter']); ?>
  468.  -->
  469.       <?php echo zen_draw_hidden_field('products_filter', $_GET['products_filter']); ?>
  470.       <?php //echo zen_draw_hidden_field('action', 'set_products_filter'); // superflous hack - ?>
  471.  
  472.          
  473.         <table summary="Manager Table" border="0" cellspacing="0" cellpadding="2">
  474.           <tr>
  475.             <td class="main" width="200" align="left" valign="top">&nbsp;</td>
  476.             <td colspan="2" class="main"><?php if (isset($_POST['products_filter'])) echo TEXT_PRODUCT_TO_VIEW; ?></td>
  477.           </tr>
  478.           <tr>
  479.             <td class="main" width="200" align="center" valign="top">
  480.  
  481. <?php  
  482.     //----- Nigel - Another ugly hack - probably need to clean up the attributes section - not really sure why the attributes section matters to IH - ask Diva
  483.   if (isset($_POST['products_filter'])) { $_GET['products_filter'] = $_POST['products_filter'];
  484.     }
  485.     //------  Nigel --End ugly hack
  486. // FIX HERE
  487. if ($_GET['products_filter'] != '') {//a category with products has been selected
  488.   $display_priced_by_attributes = zen_get_products_price_is_priced_by_attributes($_GET['products_filter']);
  489.   echo ($display_priced_by_attributes ? '<span class="alert">' . TEXT_PRICED_BY_ATTRIBUTES . '</span>' . '<br />' : '');
  490.   echo zen_get_products_display_price($_GET['products_filter']) . '<br /><br />';
  491.   echo zen_get_products_quantity_min_units_display($_GET['products_filter'], $include_break = true);
  492.   $not_for_cart = $db->Execute("select p.products_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCT_TYPES . " pt on p.products_type= pt.type_id where pt.allow_add_to_cart = 'N'");
  493. } else {//no category with products has been selected or its the first landing on admin page: nothing to show in products drop down
  494.   echo '';
  495.   $not_for_cart = new stdClass();
  496.   $not_for_cart->fields = array();
  497. }
  498. echo '</td>';
  499. if (isset($products_filter)) { //prevent creation of empty Select ?>
  500.             <td class="attributes-even" align="center"><?php echo zen_draw_products_pull_down('products_filter', 'size="5"', $not_for_cart->fields, true, $_GET['products_filter'], true, true); ?></td>
  501.             <td class="main" align="center" valign="top">
  502.               <?php
  503.                 echo zen_image_submit('button_display.gif', IMAGE_DISPLAY);
  504.               ?>
  505.             </td>
  506.             <?php } else {echo '<td>&nbsp;</td><td>&nbsp;</td>';} ?>
  507.           </tr>
  508.  
  509.         <tr>
  510.           <td colspan="3">
  511.             <table summary="Product List">
  512.  
  513. <?php
  514. // show when product is linked
  515. if ((isset($products_filter)) && zen_get_product_is_linked($products_filter) == 'true') {
  516. ?>
  517.               <tr>
  518.                 <td class="main" align="center" valign="bottom">
  519.                   <?php echo zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . '&nbsp;&nbsp;' . TEXT_LEGEND_LINKED . ' ' . zen_get_product_is_linked($products_filter, 'true'); ?>
  520.                 </td>
  521.               </tr>
  522. <?php } ?>
  523.               <tr>
  524.                 <td class="main" align="center" valign="bottom">
  525. <?php
  526.   if ($_GET['products_filter'] != '') {
  527.     echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=new_product' . '&amp;cPath=' . $current_category_id . '&amp;pID=' . $products_filter . '&amp;product_type=' . zen_get_products_type($products_filter)) . '">' . zen_image_button('button_edit_product.gif', IMAGE_EDIT_PRODUCT) . '<br />' . TEXT_PRODUCT_EDIT . '</a>';
  528.     echo '</td><td class="main" align="center" valign="bottom">';
  529.     echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&amp;current_category_id=' . $current_category_id, 'NONSSL') . '">' . zen_image_button('button_edit_attribs.gif', IMAGE_EDIT_ATTRIBUTES) . '<br />' . TEXT_ATTRIBUTE_EDIT . '</a>' . '&nbsp;&nbsp;&nbsp;';
  530.   }
  531. ?>
  532.                 </td>
  533.               </tr>
  534.             </table>
  535.           </td>
  536.         </tr>
  537.  
  538.         </table>
  539.       </form>
  540.  
  541.  
  542. <div class="managerbox">
  543. <!-- Start Photo Display -->
  544.  
  545. <?php
  546. // start of attributes display
  547. if ($products_filter == '') {
  548. ?>
  549.     <h2><?php echo IH_HEADING_TITLE_PRODUCT_SELECT; ?></h2>
  550. <?php
  551. } else {
  552.   // Get the details for the product
  553.   $product = $db->Execute("select p.products_id, p.products_model,
  554.                                      p.products_image,
  555.                                      p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.products_priced_by_attribute, p.products_status,
  556.                                      p.products_discount_type, p.products_discount_type_from, p.products_price_sorter,
  557.                                      pd.products_name,
  558.                                      p.master_categories_id
  559.                               from " . TABLE_PRODUCTS . " p, " .
  560.                                         TABLE_PRODUCTS_DESCRIPTION . " pd
  561.                               where p.products_id = '" . $_GET['products_filter'] . "'
  562.                               and p.products_id = pd.products_id
  563.                               and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");
  564.  
  565.  
  566.     if ($product->RecordCount() > 0) {
  567.         $pInfo = new objectInfo($product->fields);
  568.     }
  569.  
  570.   // Determine if there are any images and work out the file names
  571.   // (based on code from modules/pages/product_info/main_template_vars_images(& _additional) (copying is evil!))
  572.   if ($pInfo->products_image != '') {
  573.    
  574.     $products_image = $pInfo->products_image;
  575.     $products_image_match_array = array();
  576.  
  577.     // get file extension and base
  578.     $products_image_extension = substr($products_image, strrpos($products_image, '.'));
  579.     $products_image_base = preg_replace("/".$products_image_extension."$/", '', $products_image);
  580.        
  581.     // if in a subdirectory
  582.     if (strrpos($products_image_base, '/')) {
  583.       $products_image_base = substr($products_image_base, strrpos($products_image_base, '/')+1);
  584.     }
  585.    
  586.    
  587.     // sort out directory
  588.     $products_image_directory =  substr($products_image, 0, strrpos($products_image, '/'));
  589.       // add slash to base dir
  590.       if (($products_image_directory != '') && (!preg_match("|\/$|", $products_image_directory))) {
  591.         $products_image_directory .= '/';
  592.       }
  593.     $products_image_directory_full = DIR_FS_CATALOG . DIR_WS_IMAGES . $products_image_directory;
  594.    
  595.     // Check that the image exists! (out of date Database)
  596.     if (file_exists( $products_image_directory_full . $products_image_base . $products_image_extension )) {
  597.  
  598.       // Add base image to array
  599.       $products_image_match_array[] = $products_image_base . $products_image_extension;
  600.       // $products_image_base .= "_";
  601.      
  602.       // Check for additional matching images
  603.       find_additional_images($products_image_match_array, $products_image_directory_full,
  604.         $products_image_extension, $products_image_base );
  605.     }
  606.    
  607.   } // if products_image
  608.  
  609. ?>
  610.  
  611. <?php
  612.   if ($pInfo->products_id != '') {
  613. ?>
  614.     <h4>
  615.       <?php echo TEXT_PRODUCT_INFO . ': #' . $pInfo->products_id . '&nbsp;&nbsp;' . $pInfo->products_name; ?>
  616.       <?php
  617.         if ($pInfo->products_model != '') {
  618.           echo '<br />'.TEXT_PRODUCTS_MODEL . ': ' . $pInfo->products_model;
  619.         }
  620.       ?>
  621.       <?php
  622.         if ($pInfo->products_image != '') {
  623.           if (preg_match("/^([^\/]+)\//", $pInfo->products_image, $matches)) {
  624.             echo TEXT_IMAGE_BASE_DIR .': ';
  625.             echo $matches[1];
  626.           }
  627.         }
  628.       ?>
  629.     </h4>
  630.     <table border="0" width="100%" cellspacing="0" cellpadding="2"><tr><td valign="top">
  631.     <table border="0" width="100%" cellspacing="0" cellpadding="2">
  632.     <tr class="dataTableHeadingRow">
  633.       <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PHOTO_NAME; ?></td>
  634.       <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_FILETYPE; ?></td><?php //added nigel ?>
  635.       <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_DEFAULT_SIZE; ?></td>
  636.       <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_MEDIUM_SIZE; ?></td>
  637.       <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_LARGE_SIZE; ?></td>
  638.       <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  639.     </tr>
  640. <?php
  641.   $selected_image_suffix = '';
  642.   // no images
  643.   $no_images = (0 == $count = sizeof($products_image_match_array));
  644.   if ($no_images) {
  645. ?>
  646.       <tr>
  647.         <td colspan="6" class="dataTableContent" align="center"><?php echo TEXT_NO_PRODUCT_IMAGES; ?></td>
  648.       </tr>
  649. <?php
  650.   }
  651. ?>
  652.  
  653. <?php
  654.     $default_extension = 'bob';
  655.   $first = 1;
  656.   for ($i=0; $i < $count; $i++) {
  657.     // there are some pictures, show them!
  658.     $splitpos = strrpos($products_image_match_array[$i], '.');
  659.     $tmp_image_name = substr($products_image_match_array[$i], 0, $splitpos);
  660.     $products_image_extension = substr($products_image_match_array[$i], $splitpos);
  661.     if ($default_extension == 'bob') {$default_extension = $products_image_extension;}//added nigel
  662.     $image_file = DIR_WS_IMAGES . $products_image_directory . $tmp_image_name . $products_image_extension;
  663.     $image_file_medium = DIR_WS_IMAGES . 'medium/' . $products_image_directory . $tmp_image_name . IMAGE_SUFFIX_MEDIUM . $products_image_extension;
  664.     $image_file_large  = DIR_WS_IMAGES . 'large/' . $products_image_directory . $tmp_image_name . IMAGE_SUFFIX_LARGE .  $products_image_extension;
  665.  
  666.     $image_file_full = DIR_FS_CATALOG . $image_file;
  667.     $image_file_medium_full = DIR_FS_CATALOG . $image_file_medium;
  668.     $image_file_large_full = DIR_FS_CATALOG . $image_file_large;
  669.  
  670.     $tmp_image = new ih_image($image_file, $ihConf['small']['width'], $ihConf['small']['height']);
  671.     $tmp_image_file = $tmp_image->get_local();
  672.     $tmp_image_file_full = DIR_FS_CATALOG . $tmp_image_file;
  673.     $tmp_image_preview = new ih_image($tmp_image_file, IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT);
  674.  
  675.     $tmp_image_medium = new ih_image($image_file_medium, $ihConf['medium']['width'], $ihConf['medium']['height']);
  676.     $tmp_image_file_medium = $tmp_image_medium->get_local();
  677.     $tmp_image_file_medium_full = DIR_FS_CATALOG . $tmp_image_file_medium;
  678.     $tmp_image_medium_preview = new ih_image($tmp_image_file_medium, IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT);
  679.    
  680.     $tmp_image_large = new ih_image($image_file_large, $ihConf['large']['width'], $ihConf['large']['height']);
  681.     $tmp_image_file_large = $tmp_image_large->get_local();
  682.     $tmp_image_file_large_full = DIR_FS_CATALOG . $tmp_image_file_large;
  683.     $tmp_image_large_preview = new ih_image($tmp_image_file_large, IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT);
  684.  
  685.  
  686.     // Get file details
  687.     $text_default_size = get_image_details_string( $tmp_image_file_full );
  688.     $text_medium_size = get_image_details_string( $tmp_image_file_medium_full );
  689.     $text_large_size = get_image_details_string( $tmp_image_file_large_full );
  690.  
  691.     if ($first == 1) {
  692.       $tmp_image_link = zen_catalog_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $pInfo->products_id);
  693.       $first = 0;
  694.     } else {
  695.       $tmp_image_link = zen_catalog_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL,
  696.         'pID=' . $pInfo->products_id . '&pic='.($i).'&products_image_large_additional='.$tmp_image_file_large);
  697.     }
  698.  
  699.    
  700.     if ( isset($_GET['imgName']) && $_GET['imgName'] == $tmp_image_name ) {
  701.       // an image is selected, highlight it
  702.       echo '<tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\''
  703.        . zen_href_link(FILENAME_IMAGE_HANDLER, 'products_filter=' . $_GET['products_filter']
  704.        . '&amp;imgName=' .$tmp_image_name . '&amp;action=layout_edit') . '\'">' . "\n";
  705.         // set some details for later usage
  706.       $selected_image_file = DIR_WS_CATALOG . $tmp_image_file_medium;
  707.       $selected_image_file_large = DIR_WS_CATALOG . $tmp_image_file_large;
  708.         $selected_image_link = $tmp_image_link;
  709.         $selected_image_name = $tmp_image_name;
  710.         $selected_image_suffix = preg_replace("/^".$products_image_base."/", '', $tmp_image_name);
  711.         $selected_image_extension = $products_image_extension;
  712.     } else {
  713.       echo '<tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\''
  714.         . zen_href_link(FILENAME_IMAGE_HANDLER, 'products_filter=' . $_GET['products_filter']
  715.         . '&amp;imgName=' . $tmp_image_name . '&amp;action=layout_info') . '\'">' . "\n";
  716.     }
  717. ?>
  718.    
  719.       <td class="dataTableContent"><?php echo $tmp_image_name; ?></td>
  720.       <td class="dataTableContent"<?php if ($products_image_extension != $default_extension){echo 'style="color:red;"';} ?>><?php echo $products_image_extension; ?></td>
  721.       <td class="dataTableContent" align="center" valign="top">
  722.         <?php
  723.           $preview_image = $tmp_image_preview->get_resized_image(IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT, 'generic');
  724.           list($width, $height) = @getimagesize(DIR_FS_CATALOG . $preview_image);
  725.           $width = min($width, intval(IMAGE_SHOPPING_CART_WIDTH));
  726.           $height = min ($height, intval(IMAGE_SHOPPING_CART_HEIGHT));
  727.           echo zen_image(DIR_WS_CATALOG . $preview_image, addslashes($pInfo->products_name), $width, $height) . '<br />';
  728.         ?>
  729.         <?php echo $text_default_size; ?>
  730.       </td>
  731.       <td class="dataTableContent" align="center" valign="top">
  732.         <?php
  733.           $preview_image = $tmp_image_medium_preview->get_resized_image(IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT, 'generic');
  734.           list($width, $height) = @getimagesize(DIR_FS_CATALOG . $preview_image);
  735.           $width = min($width, intval(IMAGE_SHOPPING_CART_WIDTH));
  736.           $height = min ($height, intval(IMAGE_SHOPPING_CART_HEIGHT));
  737.           echo zen_image(DIR_WS_CATALOG . $preview_image, addslashes($pInfo->products_name), $width, $height) . '<br />';
  738.           echo $text_medium_size . '<br />';
  739.           if (is_file($image_file_medium_full)) {
  740.             echo ' <a href="' . zen_href_link(FILENAME_IMAGE_HANDLER, 'imgName='
  741.               . $image_file_medium . '&amp;products_filter=' . $_GET['products_filter'] . '&amp;action=quick_delete') . '">'
  742.               . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>';
  743.           }
  744.         ?>
  745.       </td>
  746.       <td class="dataTableContent" align="center" valign="top">
  747.         <?php
  748.           $preview_image = $tmp_image_large_preview->get_resized_image(IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT, 'generic');
  749.           list($width, $height) = @getimagesize(DIR_FS_CATALOG . $preview_image);
  750.           $width = min($width, intval(IMAGE_SHOPPING_CART_WIDTH));
  751.           $height = min ($height, intval(IMAGE_SHOPPING_CART_HEIGHT));
  752.           echo zen_image(DIR_WS_CATALOG . $preview_image, addslashes($pInfo->products_name), $width, $height) . '<br />';
  753.           echo $text_large_size . '<br />';
  754.           if (is_file($image_file_large_full)) {
  755.             echo ' <a href="' . zen_href_link(FILENAME_IMAGE_HANDLER, 'imgName='
  756.               . $image_file_large . '&amp;products_filter=' . $_GET['products_filter'] . '&amp;action=quick_delete') . '">'
  757.               . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>';
  758.           }
  759.         ?>
  760.       </td>
  761.       <td class="dataTableContent" align="right"><?php
  762.         if ( isset($_GET['imgName']) && $_GET['imgName'] == $tmp_image_name ) {
  763.           echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', '');
  764.         } else {
  765.           echo '<a href="' . zen_href_link(FILENAME_IMAGE_HANDLER, 'products_filter=' . $_GET['products_filter']
  766.             . '&amp;imgName=' . $tmp_image_name . '&amp;action=layout_info')
  767.             . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>';
  768.         }
  769.       ?>&nbsp;</td>
  770.     </tr>
  771. <?php  
  772.    
  773.   } // for each photo loop
  774. ?>
  775.   </table></td><!-- END Photo list table -->
  776.   <!-- Start Data Edit Pane -->
  777. <?php
  778.   $heading = array();
  779.   $contents = array();
  780.  
  781.   $imgNameStr = '';
  782.   switch ($action) {
  783.     case 'layout_info':
  784.       // edit
  785.       list($width, $height) = @getimagesize(DIR_FS_CATALOG . $selected_image_file);
  786. //      $width = min($width, intval(MEDIUM_IMAGE_WIDTH));
  787. //      $height = min($height, intval(MEDIUM_IMAGE_HEIGHT));
  788.       $heading[] = array('text' => '<strong>' . TEXT_INFO_IMAGE_INFO . '</strong>');
  789.       $contents = array('align' => 'center', 'form' => zen_draw_form('image_define', FILENAME_IMAGE_HANDLER,
  790.         'page=' . $_GET['page'] . '&amp;products_filter=' . $_GET['products_filter'] . '&amp;action=save', 'post', 'enctype="multipart/form-data"'));
  791.           $contents[] = array('text' => '<strong>'.TEXT_INFO_NAME.': </strong>' . $selected_image_name .'<br />');
  792.           $contents[] = array('text' => '<strong>'.TEXT_INFO_FILE_TYPE.': </strong>' . $selected_image_extension .'<br />');
  793.           $contents[] = array('text' =>
  794.               '<script language="javascript" type="text/javascript"><!--
  795.              document.write(\'<a href="javascript:popupWindow(\\\'' . $selected_image_link . '\\\')">'
  796.              . zen_image($selected_image_file, addslashes($pInfo->products_name), $width, $height)
  797.              . '<br />' . TEXT_CLICK_TO_ENLARGE . '<\/a>\');'
  798.               .'//-->'
  799.         .'</script>
  800.        <noscript>'
  801.         .'<a href="' . zen_href_link($selected_image_file_large) . '" target="_blank">'
  802.             . zen_image($selected_image_file, $pInfo->products_name, $width, $height)
  803.             . TEXT_CLICK_TO_ENLARGE . '</a>'
  804.         .'</noscript>' );
  805.       // show new, delete, and edit buttons
  806.       $contents[] = array('align' => 'center', 'text' => '<br />' .
  807.         ' <a href="' . zen_href_link(FILENAME_IMAGE_HANDLER, 'imgName='
  808.         . $_GET['imgName'] . '&amp;products_filter=' . $_GET['products_filter'] . '&amp;action=layout_edit') . '">'
  809.         . zen_image_button('button_edit.gif', IH_IMAGE_EDIT) . '</a> &nbsp; '
  810.         .' <a href="' . zen_href_link(FILENAME_IMAGE_HANDLER, 'imgName='
  811.         . $_GET['imgName'] . '&amp;products_filter=' . $_GET['products_filter'] . '&amp;action=layout_delete') . '">'
  812.         . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a> &nbsp;'
  813.         .' <a href="' . zen_href_link(FILENAME_IMAGE_HANDLER,
  814.         '&amp;products_filter=' . $_GET['products_filter'] . '&amp;action=layout_new') . '">'
  815.         . zen_image_button('button_new_file.gif', IH_IMAGE_NEW_FILE) . '</a>');
  816.      
  817.       break;
  818.     case 'layout_edit':
  819.       // Edit specific details
  820.       $imgNameStr = '&amp;imgEdit=1' .'&amp;imgBase=' . $products_image_base
  821.           . "&amp;imgSuffix=" . $selected_image_suffix
  822.           . "&amp;imgBaseDir=" . $products_image_directory
  823.           . "&amp;imgExtension=" . $selected_image_extension;
  824.       $heading[] = array('text' => '<strong>' . TEXT_INFO_EDIT_PHOTO . '</strong>');
  825.  
  826.     case 'layout_new':  
  827.      
  828. /*      if ( $action != 'layout_edit' ) {
  829.         $imgNameStr .= ( $no_images ) ? "&newImg=1" : '&amp;imgBase='.$products_image_base
  830.           . "&amp;imgBaseDir=" . $products_image_directory
  831.           . "&amp;imgExtension=" . $products_image_extension;
  832.         $heading[] = array('text' => '<strong>' . TEXT_INFO_NEW_PHOTO . '</strong>');
  833.       }
  834.  */    
  835.       if ( $action != 'layout_edit' ) {
  836.         $imgNameStr .= ( $no_images ) ? "&amp;newImg=1" : '&amp;imgBase='.$products_image_base
  837.           . "&amp;imgBaseDir=" . $products_image_directory
  838.           . "&amp;imgExtension=" . $default_extension;
  839.         $heading[] = array('text' => '<strong>' . TEXT_INFO_NEW_PHOTO . '</strong>');
  840.       }
  841.      
  842.      
  843.       $contents = array('form' => zen_draw_form('image_define', FILENAME_IMAGE_HANDLER,
  844.         '&products_filter=' . $_GET['products_filter'] . $imgNameStr
  845.         .'&amp;action=save', 'post', 'enctype="multipart/form-data"'));//steve check this &products_filter=
  846.  
  847.       // check if this is a master image or if no images exist
  848.       if ($no_images) {
  849.         $contents[] = array('text' => '<strong>'.TEXT_INFO_IMAGE_BASE_NAME.'</strong><br />' );
  850.         $contents[] = array('text' => zen_draw_input_field('imgBase', '', 'size="30"'));
  851.              
  852.         $dir = @dir(DIR_FS_CATALOG_IMAGES);
  853.             $dir_info[] = array('id' => '', 'text' => TEXT_INFO_MAIN_DIR);
  854.             while ($file = $dir->read()) {
  855.               if (is_dir(DIR_FS_CATALOG_IMAGES . $file)
  856.                   && strtoupper($file) != 'CVS'
  857.                   && $file != "."
  858.                   && $file != ".."
  859.                   && $file != 'original'
  860.                   && $file != 'medium'
  861.                   && $file != 'large') {
  862.                   $dir_info[] = array('id' => $file . '/', 'text' => $file);
  863.               }
  864.             }
  865.             $contents[] = array('text' => '<br /><strong>'.TEXT_INFO_BASE_DIR.'</strong><br />'.TEXT_INFO_NEW_DIR);
  866.             $contents[] = array('text' => TEXT_INFO_IMAGE_DIR . zen_draw_pull_down_menu('imgBaseDir', $dir_info, ""));
  867.             $contents[] = array('text' => TEXT_INFO_OR.' ' . zen_draw_input_field('imgNewBaseDir', '', 'size="20"') );
  868.  
  869.       } else if ($action != 'layout_edit') {
  870.             $contents[] = array('text' => '<strong>'.TEXT_INFO_IMAGE_SUFFIX.'</strong><br />'.TEXT_INFO_USE_AUTO_SUFFIX.'<br />' );
  871.             $contents[] = array('text' => zen_draw_input_field('imgSuffix', $selected_image_suffix, 'size="10"') );
  872.       }
  873.  
  874.       // Image fields
  875.         // Nigels ugly hack to display warning on edit screen that the default file must be filled in
  876.         if ( $action == 'layout_new' ) {// -this section is the hack
  877.         //-------------------------
  878.       $contents[] = array('text' => '<br /><strong>' . TEXT_INFO_DEFAULT_IMAGE . '</strong>&nbsp;&nbsp;<strong class="errorText">(required)</strong><br />'
  879.           . TEXT_INFO_DEFAULT_IMAGE_HELP . '<br />'
  880.           . zen_draw_input_field('default_image', '', 'size="20" ', false, 'file') . '<br />' . $pInfo->products_image);
  881.         } else { // this section is the original code
  882.       $contents[] = array('text' => '<br /><strong>' . TEXT_INFO_DEFAULT_IMAGE . '</strong><br />'
  883.           . TEXT_INFO_DEFAULT_IMAGE_HELP . '<br />'
  884.           . zen_draw_input_field('default_image', '', 'size="20" ', false, 'file') . '<br />' . $pInfo->products_image);
  885.            
  886.         }
  887.  
  888.       if ( $action == 'layout_edit' ) {
  889.         if ( $selected_image_name == $products_image_match_array[0]) {
  890.           $contents[] = array('text' => zen_draw_radio_field('imgNaming', 'new_discard', true)
  891.                 . IH_NEW_NAME_DISCARD_IMAGES . '<br />'
  892. //  new_copy functionality scheduled for future release                
  893. //            . zen_draw_radio_field('imgNaming', 'new_copy', false)
  894. //                . IH_NEW_NAME_COPY_IMAGES . '<br />'
  895.             . zen_draw_radio_field('imgNaming', 'keep_name', false)
  896.                 . IH_KEEP_NAME);
  897.         }
  898.       }
  899.  
  900.        $contents[] = array('text' => '<br /><strong>' . TEXT_MEDIUM_FILE_IMAGE . '</strong><br />' .
  901.           zen_draw_input_field('medium_image', '', 'size="20" ', false, 'file') . '<br />');
  902.       $contents[] = array('text' => '<br /><strong>' . TEXT_LARGE_FILE_IMAGE . '</strong><br />' .
  903.           zen_draw_input_field('large_image', '', 'size="20" ', false, 'file') . '<br />');
  904.       $contents[] = array('align' => 'center', 'text' => '<br />' . zen_image_submit('button_save.gif', IMAGE_SAVE) );
  905.       break;
  906.     case 'layout_delete':
  907.  
  908.       $imgStr = "&amp;imgBase=" . $products_image_base
  909.           . "&amp;imgSuffix=" . $selected_image_suffix
  910.           . "&amp;imgBaseDir=" . $products_image_directory
  911.           . "&amp;imgExtension=" . $selected_image_extension;
  912.          
  913.       // show new button      
  914.       $heading[] = array('text' => '<strong>' . TEXT_INFO_CONFIRM_DELETE . '</strong>');
  915.      
  916.       $contents[] = array('text' => '<br />' . $products_image_directory.$products_image_base.$selected_image_suffix.$selected_image_extension);
  917.       $contents[] = array('text' => '<br />' . TEXT_INFO_CONFIRM_DELETE_SURE);
  918.       if ($selected_image_suffix == '') {
  919.         $contents[] = array('text' => zen_draw_checkbox_field('delete_from_database_only', 'Y', false) . IH_DELETE_FROM_DB_ONLY);
  920.       }
  921.  
  922.       $contents[] = array('align' => 'center', 'text' => '<br />'
  923.         .' <a href="' . zen_href_link(FILENAME_IMAGE_HANDLER,
  924.         '&amp;products_filter=' . $_GET['products_filter'] . '&amp;action=delete'
  925.         . $imgStr ) . '">'
  926.         . zen_image_button( 'button_delete.gif', IMAGE_DELETE ) . '</a>');
  927.       break;
  928.     default:
  929.       // show new button      
  930.       $heading[] = array('text' => '<strong>' . TEXT_INFO_SELECT_ACTION . '</strong>');
  931.       $contents = array('form' => zen_draw_form('image_define', FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page'] . '&amp;action=new', 'post', 'enctype="multipart/form-data"'));
  932.       $contents[] = array('text' => '<br />' . TEXT_INFO_CLICK_TO_ADD);
  933.       $contents[] = array('align' => 'center', 'text' => '<br />'
  934.         .' <a href="' . zen_href_link(FILENAME_IMAGE_HANDLER,
  935.         '&amp;products_filter=' . $_GET['products_filter'] . '&amp;action=layout_new') . '">'
  936.         . zen_image_button('button_new_file.gif', IH_IMAGE_NEW_FILE) . '</a>');
  937.       break;
  938.   }
  939.  
  940.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  941.     echo '            <td width="25%" valign="top">' . "\n";
  942.  
  943.     $box = new box;
  944.     echo $box->infoBox($heading, $contents);
  945.  
  946.     echo '            </td>' . "\n";
  947.   }
  948. ?>  
  949.   </tr></table>
  950. <?php
  951.  
  952.   } // if products_id
  953.  
  954. } // if products_filter
  955. ?>
  956. </div>
  957. <?php
  958. } // if $page == 'manager'
  959.  
  960.  
  961. /**
  962.  * PREVIEW TABPAGE
  963.  */
  964.  
  965. if ($page == 'preview') {
  966.   $images = array();
  967.   $pngimage = new ih_image(basename($ihConf['dir']['admin']) . "/" . 'images/ih-test.png', intval($ihConf['small']['width']), intval($ihConf['small']['height']));
  968.   $images['pngsource'] = $pngimage->get_resized_image(intval($ihConf['small']['width']), intval($ihConf['small']['height']), 'orig');
  969.   $images['pngsmall'] = $pngimage->get_resized_image($ihConf['small']['width'], $ihConf['small']['height'], 'small');
  970.   $images['pngmedium'] = $pngimage->get_resized_image($ihConf['medium']['width'], $ihConf['medium']['height'], 'medium');
  971.   $images['pnglarge'] = $pngimage->get_resized_image($ihConf['large']['width'], $ihConf['large']['height'], 'large');
  972.  
  973.   $jpgimage = new ih_image(basename($ihConf['dir']['admin']) . "/" . 'images/ih-test.jpg', intval($ihConf['small']['width']), intval($ihConf['small']['height']));
  974.   $images['jpgsource'] = $jpgimage->get_resized_image(intval($ihConf['small']['width']), intval($ihConf['small']['height']), 'orig');
  975.   $images['jpgsmall'] = $jpgimage->get_resized_image($ihConf['small']['width'], $ihConf['small']['height'], 'small');
  976.   $images['jpgmedium'] = $jpgimage->get_resized_image($ihConf['medium']['width'], $ihConf['medium']['height'], 'medium');
  977.   $images['jpglarge'] = $jpgimage->get_resized_image($ihConf['large']['width'], $ihConf['large']['height'], 'large');
  978.  
  979.   $gifimage = new ih_image(basename($ihConf['dir']['admin']) . "/" . 'images/ih-test.gif', intval($ihConf['small']['width']), intval($ihConf['small']['height']));
  980.   $images['gifsource'] = $gifimage->get_resized_image(intval($ihConf['small']['width']), intval($ihConf['small']['height']), 'orig');
  981.   $images['gifsmall'] = $gifimage->get_resized_image($ihConf['small']['width'], $ihConf['small']['height'], 'small');
  982.   $images['gifmedium'] = $gifimage->get_resized_image($ihConf['medium']['width'], $ihConf['medium']['height'], 'medium');
  983.   $images['giflarge'] = $gifimage->get_resized_image($ihConf['large']['width'], $ihConf['large']['height'], 'large');
  984.  
  985. ?>
  986.   <table summary="Preview Images" style="background-color:#F5F5F5" cellspacing="0" cellpadding="5" border="0">
  987.     <tr>
  988.         <th style="border-bottom: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC"><?php echo IH_SOURCE_TYPE; ?></th>
  989.         <th style="border-bottom: 1px solid #CCCCCC"><?php echo IH_SOURCE_IMAGE; ?></th>
  990.         <th style="border-bottom: 1px solid #CCCCCC"><?php echo IH_SMALL_IMAGE; ?></th>
  991.         <th style="border-bottom: 1px solid #CCCCCC"><?php echo IH_MEDIUM_IMAGE; ?></th>
  992.     </tr>
  993.     <!-- source png row -->
  994.     <tr>
  995.         <td style="border-right: 1px solid #CCCCCC"><strong>png</strong></td>
  996.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['pngsource']?>" alt="png source" title="png source" /></td>
  997.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['pngsmall']?>" alt="png small" title="png small" /></td>
  998.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['pngmedium']?>" alt="png medium" title="png medium" /></td>
  999.     </tr>
  1000.     <!-- source jpg row -->
  1001.     <tr>
  1002.         <td style="border-right: 1px solid #CCCCCC"><strong>jpg</strong></td>
  1003.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['jpgsource']?>" alt="jpg source" title="jpg source" /></td>
  1004.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['jpgsmall']?>" alt="jpg small" title="jpg small" /></td>
  1005.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['jpgmedium']?>" alt="jpg medium" title="jpg medium" /></td>
  1006.     </tr>
  1007.     <!-- source gif row -->
  1008.     <tr style="border-right: 1px solid #CCCCCC">
  1009.         <td style="border-right: 1px solid #CCCCCC"><strong>gif</strong></td>
  1010.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['gifsource']?>" alt="gif source" title="gif source" /></td>
  1011.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['gifsmall']?>" alt="gif small" title="gif small" /></td>
  1012.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['gifmedium']?>" alt="gif medium" title="gif medium" /></td>
  1013.     </tr>
  1014.   </table>
  1015. <?php
  1016. }
  1017.  
  1018.  
  1019.  
  1020. /**
  1021.  * ABOUT TABPAGE
  1022.  */
  1023.  
  1024. if ($page == 'about') {
  1025. ?>
  1026. <div class="aboutbox">
  1027. <h2>Image Handler<sup>4</sup> v4.0 for v1.5.x</h2>
  1028.  
  1029. <p>
  1030. Image Handler<sup>4</sup> v4.0 for v1.5.x is based on an original contribution by Tim Kr&#246;ger.<br /></p>
  1031. <fieldset>
  1032. <legend>Purpose &amp; Aim</legend>
  1033. <p>Image Handler<sup>4</sup> at the heart of it's code is really meant to ease the management of product images (particularly the management of additional product images), and to help improve page performance by optimizing the product images.</p>
  1034. <p>Image Handler<sup>4</sup> generates product images (based on your image settings) in the Image Handler<sup>4</sup> CATALOG/bmz_cache folder. It <strong>DOES NOT</strong> replace or modify the original images. So it's PERFECTLY safe to use on an existing store.</p>
  1035. <p> Image Handler<sup>4</sup> enables you to use GD libraries or ImageMagick (if installed on your server) to generate and resize small, medium and large images on-the-fly/on page request. You can simply upload just one large image (that gets resized as required) or you can have different sources for medium and large images.<br />
  1036. Image Handler<sup>4</sup> also enables you to watermark your images on-the-fly (overlay a second specific translucent image onto the original) and have medium or large images pop up when you move your mouse over a small image (fancy hover).</p>
  1037. <p> This contribution includes a powerful admin interface to browse your   products just like you would with the Attribute Manager and upload /   delete / add additional images without having to do this manually via <acronym title="File Transfer Protocol">FTP</acronym>. Image Handler<sup>4</sup> works fine with mass update utilities like EzPopulate. </p>
  1038. </fieldset>
  1039. <hr>
  1040. <fieldset>
  1041. <legend>Features</legend>
  1042. <ul>
  1043.   <li>Improves site performance (faster loading, faster display)</li>
  1044.   <li>Professional looking images (no stair-effects, smooth edges)</li>
  1045.   <li>Choose preferred image-types for each image size</li>
  1046.   <li>Uploading one image automatically creates small, medium and large images on page request</li>
  1047.   <li>Drops in and out seamlessly. No need to redo your images. All images are kept.</li>
  1048.   <li>Easy install. One-click-database-upgrade.</li>
  1049.   <li>Works with mass-update/-upload tools like EzPopulate.</li>
  1050.   <li>Watermark images to prevent competitors from stealing them. (prove ownership)</li>
  1051.   <li>Fancy image hover functionality lets a larger image pop up whenever you move your mouse above a small image (optional).</li>
  1052.   <li>Choose an image background color to match your site or select a transparent background for your images.</li>
  1053.   <li>Manage multiple images for products easily from one page just like you do with attributes in the Products Attribute Manager.</li>
  1054. </ul>
  1055. <p>Image Handler<sup>4</sup> is meant to ease the work required to setup images for your store.   It works WITH default Zen Cart functionality, it does not replace it. </p>
  1056. <p>It is very strongly recommend you read through the ENTIRE "<strong>Configuration</strong>" &amp; "<strong>Usage</strong>" sections of the Image Handler<sup>4</sup> readme file. There you will find out exactly what <strong>Image Handler<sup>4</sup></strong> can do.</p>
  1057. </fieldset>
  1058.  
  1059. <hr>
  1060.  
  1061. <fieldset>
  1062. <legend>Troubleshooting Basics</legend>
  1063. <p>Make sure your custom template is active. (Admin &gt; Tools &gt; Template Selection)</p>
  1064. <p>Make sure Image Handler<sup>4</sup> is installed. <strong>Admin
  1065. &gt; Tools &gt; Image Handler<sup>4</sup> &gt; Admin</strong>.
  1066. Set permissions in both your <strong>images</strong> and <strong>bmz_cache</strong> folders to 755 (eg: <strong>both </strong>of these folders need
  1067. to have  the same permissions. For some webhosts you may have to set these permissions to 777).</p>
  1068. <p>If Image Handler<sup>4</sup> does not work or gives you errors:</p>
  1069. <ul>
  1070.   <li>Make sure all files are in correct location</li>
  1071.   <li>Make sure you uploaded ALL the Image Handler<sup>4</sup> files</li>
  1072.   <li>Make sure the files are not corrupt from bad FTP transfers</li>
  1073.   <li>Make sure your file merge edits are correct</li>
  1074.   <li>MAKE SURE YOU RE-READ THE CONFIGURATION AND USAGE SECTIONS!!!</li>
  1075.   <li>Make sure that there are no javascript conflicts (this last point has been largely addressed since Rev 7)</li>
  1076.   <li>Make sure that your main product image files names DO NOT contain any special characters (<font>non-alphanumeric characters such as / \ :
  1077. ! @ # $ % ^ &lt; &gt; , [ ] { } &amp; * ( ) + = </font>). Always use proper filenaming practices when naming your images - See this document as a reference: <small><a href="http://www.records.ncdcr.gov/erecords/filenaming_20080508_final.pdf" target="_blank">http://www.records.ncdcr.gov/erecords/filenaming_20080508_final.pdf\</a></small></li>
  1078. </ul>
  1079. </fieldset>
  1080.  
  1081. <hr>
  1082.  
  1083. <fieldset>
  1084. <legend>Zen Cart and Image Management</legend>
  1085. <p>Image Handler<sup>4</sup> is meant to ease the work required to setup images for your store..   It works WITH default Zen Cart functionality, it does not replace it..   Here's some additional FAQs which discuss how product images work in Zen   Cart.</p>
  1086. <ul>
  1087.   <li><a href="http://tutorials.zen-cart.com/index.php?article=224" target="_blank">Image Preparation - How-to</a></li>
  1088.   <li><a href="http://tutorials.zen-cart.com/index.php?article=30" target="_blank">My images are distorted/fuzzy/squished, help?</a><br>
  1089.   </li>
  1090. </ul>
  1091. <p>Information on how Zen Cart   identifies/manages additional product images can be found on these Zen Cart FAQs:</p>
  1092. <ul>
  1093.   <li><a href="http://tutorials.zen-cart.com/index.php?article=315" target="_blank">Why am I seeing images for other products on my product pages?</a></li>
  1094.   <li><a href="http://tutorials.zen-cart.com/index.php?article=58" target="_blank">How do I add multiple images to a product?</a></li>
  1095.   <li><a href="http://tutorials.zen-cart.com/index.php?article=202" target="_blank">How   do I add more than one image of a product?  I want to have a main image   and also one or two other images that show more parts of a particular   product. How/where do I add additional images to a product page?    Thanks!</a></li>
  1096. </ul>
  1097. <p>Check out these FAQs and see if they help clarify how Zen Cart works with product images.</p>
  1098. </fieldset>
  1099.  
  1100. <hr>
  1101.  
  1102. <fieldset>
  1103. <legend> Prepare Your Site for Growth</legend>
  1104. <p>Not many users are aware that Image Handler<sup>4</sup> can manage the needs of a very large site as easily as it does a small one. When first building a site, the owner of a small site needs only to load images to the images folder. But when the site gets bigger and images multiply like rabbits, this can cause file naming confusions for Zen Cart and slow down the site. Preparing for your business to grow from the beginning will save you hours of work later on!</p>
  1105. <p>Without Image Handler<sup>4</sup> installed, Zen Cart requires you to create, optimize, and upload three different size images for each image you want to use. You must name these images using naming suffixes, and place them in corresponding folders inside your main image folder. For example: A product called &quot;Widget&quot; requires images/widget.jpg (small image) images/medium/widget_MED.jpg (medium image) and images/large/widget_LRG.jpg. This is such a hassle, especially if many of your products have multiple images. And as your site grows, it becomes an impossible task!</p>
  1106. <p>With Image Handler<sup>4</sup>, you no longer have to make three sizes of the same images and place them in different folders (unless you want to)! Instead, you need upload only one image in one folder and Image Handler<sup>4</sup> will do the rest! Simply upload your largest highest quality image and Image Handler<sup>4</sup> will resize and optimize your image as needed, and serve up small, medium, or large image sizes appropriate to the page loaded - all automatically and all without actually modifying your original image file in any way! Check out the Configuration Tab of this ReadMe for more info about this awesome functionality!</p>
  1107. <p>Prepare your site for growth by simply creating sub-folders in your main images folder. For example, you may want to put all your &quot;widget&quot; images in a folder called &quot;widgets&quot; and all your doodad images in a folder called &quot;doodads&quot; , like this:<br>
  1108. </p>
  1109. <p>Product: Blue Widget with 3 images<br>
  1110.   ---------------------------------- <br>
  1111.   /images/widgets/blue_widget1.jpg (main product image for a blue widget, i.e. front view)<br>
  1112.   /images/widgets/blue_widget2.jpg (additional product image for a blue widget, i.e. side view)<br>
  1113.   /images/widgets/blue_widget3.jpg (additional product image for a blue widget, i.e. rear view)</p>
  1114. <p>&nbsp;</p>
  1115. <p>Product: Red Widget with 1 image<br>
  1116.   --------------------------------<br>
  1117.   /images/widgets/red_widget.jpg (main product image for a red widget)</p>
  1118. <p>&nbsp;</p>
  1119. <p>Product: Gold Doodad with 2 images<br>
  1120.   ----------------------------------<br>
  1121.   /images/doodads/gold_doodad1.jpg (main product image for a gold doodad, i.e. view from above)<br>
  1122.   /images/doodads/gold_doodad2.jpg (additional product image for a gold doodad, i.e. view from side)</p>
  1123. <p>&nbsp;</p>
  1124. <p>Product: Silver Doodad with 3 images<br>
  1125.   ------------------------------------<br>
  1126.   /images/doodads/silver_doodad1.jpg (main product image for a silver doodad, i.e. product)<br>
  1127.   /images/doodads/silver_doodad2.jpg (additional product image for a silver doodad, i.e. product detail)<br>
  1128.   /images/doodads/silver_doodad3.jpg (additional product image for a silver doodad, i.e. product's silver stamp)<br>
  1129. </p>
  1130. <p>Using Image Handler<sup>4</sup>, you can easily sort and manage thousands of images without confusion or hassle! When selecting the main image for a product in the Image Handler<sup>4</sup> interface, Image Handler<sup>4</sup> lets you pick the location for this image. This prompt disappears afterwards because Image Handler<sup>4</sup> knows that additional images need to be in the same folder as their main product image and handles that automatically!</p>
  1131. </fieldset>
  1132.  
  1133. </div>
  1134.  
  1135. <?php
  1136. }
  1137. ?></div>
  1138. <!-- body_eof //-->
  1139. <!-- footer //-->
  1140. <?php
  1141.     require(DIR_WS_INCLUDES . 'footer.php');
  1142. ?>
  1143. <!-- footer_eof //-->
  1144. </body>
  1145. </html>
  1146. <?php
  1147.     require(DIR_WS_INCLUDES . 'application_bottom.php');
  1148.  


cron