function handle_image($src, $alt, $width, $height, $parameters) { global $ihConf; if ($ihConf['resize']) { $ih_image = new ih_image($src, $width, $height); // override image path, get local image from cache if ($ih_image) { $src = $ih_image->get_local(); $parameters = $ih_image->get_additional_parameters($alt, $ih_image->canvas['width'], $ih_image->canvas['height'], $parameters); } } else { // default to standard Zen-Cart fallback behavior for large -> medium -> small images $image_ext = substr($src, strrpos($src, '.')); $image_base = substr($src, strlen(DIR_WS_IMAGES), -strlen($image_ext)); if (strrpos($src, IMAGE_SUFFIX_LARGE) && !is_file(DIR_FS_CATALOG . $src)) { //large image wanted but not found $image_base = $ihConf['medium']['prefix'] . substr($image_base, strlen($ihConf['large']['prefix']), -strlen($ihConf['large']['suffix'])) . $ihConf['medium']['suffix']; $src = DIR_WS_IMAGES . $image_base . $image_ext; } if (strrpos($src, IMAGE_SUFFIX_MEDIUM) && !is_file(DIR_FS_CATALOG . $src)) { //medium image wanted but not found $image_base = substr($image_base, strlen($ihConf['medium']['prefix']), -strlen($ihConf['medium']['suffix'])); $src = DIR_WS_IMAGES . $image_base . $image_ext; } } return array($src, $alt, intval($width), intval($height), $parameters); }
function get_additional_parameters($alt, $width, $height, $parameters) { global $ihConf; if ($this->sizetype == 'small') { if ($ihConf[$this->sizetype]['zoom']) { if ($this->zoom['file'] == '' || !$ihConf[$this->sizetype]['hotzone']) { // if no zoom image, the whole image triggers the popup $this->zoom['startx'] = 0; $this->zoom['starty'] = 0; $this->zoom['width'] = $width; $this->zoom['height'] = $height; } //escape possible quotes if they're not already escapped $alt = addslashes(htmlentities($alt, ENT_COMPAT, CHARSET)); // strip potential suffixes just to be sure $src = $this->strip_sizetype_suffix($this->src); // define zoom sizetype if (ZOOM_IMAGE_SIZE == 'Medium') { $zoom_sizetype = $this->sizetype == 'small' ? 'medium' : 'large'; } else { $zoom_sizetype = $this->sizetype == 'small' ? 'large' : 'medium'; } // additional zoom functionality $products_image_directory = substr($src, strlen($ihConf['dir']['images']), strrpos($src, '/') - strlen($ihConf['dir']['images']) + 1); $products_image_filename = substr($src, strrpos($src, '/') + 1, strlen($src) - (strrpos($src, '/') + 1) - strlen($this->extension)); $products_image_zoom = $ihConf['dir']['images'] . $zoom_sizetype . '/' . $products_image_directory . $products_image_filename . $ihConf[$zoom_sizetype]['suffix'] . $this->extension; $ih_zoom_image = new ih_image($products_image_zoom, $ihConf[$zoom_sizetype]['width'], $ihConf[$zoom_sizetype]['height']); $products_image_zoom = $ih_zoom_image->get_local(); list($zoomwidth, $zoomheight) = @getimagesize($ihConf['dir']['docroot'] . $products_image_zoom); // we should parse old parameters here and possibly merge some inc case they're duplicate $parameters .= $parameters != '' ? ' ' : ''; return $parameters . 'style="position:relative" onmouseover="showtrail(' . "'{$products_image_zoom}','{$alt}',{$width},{$height},{$zoomwidth},{$zoomheight},this," . $this->zoom['startx'] . ',' . $this->zoom['starty'] . ',' . $this->zoom['width'] . ',' . $this->zoom['height'] . ');" onmouseout="hidetrail();" '; } return $parameters; } return $parameters; }
$image_file = DIR_WS_IMAGES . $products_image_directory . $tmp_image_name . $products_image_extension; $image_file_medium = DIR_WS_IMAGES . 'medium/' . $products_image_directory . $tmp_image_name . IMAGE_SUFFIX_MEDIUM . $products_image_extension; $image_file_large = DIR_WS_IMAGES . 'large/' . $products_image_directory . $tmp_image_name . IMAGE_SUFFIX_LARGE . $products_image_extension; $image_file_full = DIR_FS_CATALOG . $image_file; $image_file_medium_full = DIR_FS_CATALOG . $image_file_medium; $image_file_large_full = DIR_FS_CATALOG . $image_file_large; $tmp_image = new ih_image($image_file, $ihConf['small']['width'], $ihConf['small']['height']); $tmp_image_file = $tmp_image->get_local(); $tmp_image_file_full = DIR_FS_CATALOG . $tmp_image_file; $tmp_image_preview = new ih_image($tmp_image_file, IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT); $tmp_image_medium = new ih_image($image_file_medium, $ihConf['medium']['width'], $ihConf['medium']['height']); $tmp_image_file_medium = $tmp_image_medium->get_local(); $tmp_image_file_medium_full = DIR_FS_CATALOG . $tmp_image_file_medium; $tmp_image_medium_preview = new ih_image($tmp_image_file_medium, IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT); $tmp_image_large = new ih_image($image_file_large, $ihConf['large']['width'], $ihConf['large']['height']); $tmp_image_file_large = $tmp_image_large->get_local(); $tmp_image_file_large_full = DIR_FS_CATALOG . $tmp_image_file_large; $tmp_image_large_preview = new ih_image($tmp_image_file_large, IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT); // Get file details $text_default_size = get_image_details_string($tmp_image_file_full); $text_medium_size = get_image_details_string($tmp_image_file_medium_full); $text_large_size = get_image_details_string($tmp_image_file_large_full); if ($first == 1) { $tmp_image_link = zen_catalog_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $pInfo->products_id); $first = 0; } else { $tmp_image_link = zen_catalog_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, 'pID=' . $pInfo->products_id . '&pic=' . $i . '&products_image_large_additional=' . $tmp_image_file_large); } if ($_GET['imgName'] == $tmp_image_name) { // an image is selected, highlight it echo '<tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_IMAGE_HANDLER, 'products_filter=' . $_GET['products_filter'] . '&imgName=' . $tmp_image_name . '&action=layout_edit') . '\'">' . "\n";
function get_additional_parameters($alt, $width, $height, $parameters) { global $ihConf; if ($this->sizetype == 'small') { if ($ihConf[$this->sizetype]['zoom']) { if ($this->zoom['file'] == '' || !$ihConf[$this->sizetype]['hotzone']) { // if no zoom image, the whole image triggers the popup $this->zoom['startx'] = 0; $this->zoom['starty'] = 0; $this->zoom['width'] = $width; $this->zoom['height'] = $height; } //escape possible quotes if they're not already escapped $alt = preg_replace("/([^\\\\])'/", '$1\\\'', $alt); $alt = str_replace('"', '"', $alt); // strip potential suffixes just to be sure $src = $this->strip_sizetype_suffix($this->src); // define zoom sizetype $zoom_sizetype = $this->sizetype == 'small' ? 'medium' : 'large'; // additional zoom functionality $products_image_directory = substr($src, strlen($ihConf['dir']['images']), strrpos($src, '/') - strlen($ihConf['dir']['images']) + 1); $products_image_filename = substr($src, strrpos($src, '/'), strlen($src) - strrpos($src, '/') - strlen($this->extension)); $products_image_zoom = $ihConf['dir']['images'] . $zoom_sizetype . '/' . $products_image_directory . $products_image_filename . $ihConf[$zoom_sizetype]['suffix'] . $this->extension; $ih_zoom_image = new ih_image($products_image_zoom, $ihConf[$zoom_sizetype]['width'], $ihConf[$zoom_sizetype]['height']); $products_image_zoom = $ih_zoom_image->get_local(); list($zoomwidth, $zoomheight) = @getimagesize($ihConf['dir']['docroot'] . $products_image_zoom); // we should parse old parameters here and possibly merge some inc case they're duplicate $parameters .= $parameters != '' ? ' ' : ''; return $parameters . 'style="position:relative"'; //onmouseover="showtrail(' . "'$products_image_zoom','$alt',$width,$height,$zoomwidth,$zoomheight,this," . $this->zoom['startx'].','.$this->zoom['starty'].','.$this->zoom['width'].','.$this->zoom['height'].');" onmouseout="hidetrail();" //caizhouqing update img onmouseover } } }