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; }
/** * PREVIEW TABPAGE */ if ($page == 'preview') { $images = array(); $pngimage = new ih_image(basename($ihConf['dir']['admin']) . "/" . 'images/ih-test.png', intval($ihConf['small']['width']), intval($ihConf['small']['height'])); $images['pngsource'] = $pngimage->get_resized_image(intval($ihConf['small']['width']), intval($ihConf['small']['height']), 'orig'); $images['pngsmall'] = $pngimage->get_resized_image($ihConf['small']['width'], $ihConf['small']['height'], 'small'); $images['pngmedium'] = $pngimage->get_resized_image($ihConf['medium']['width'], $ihConf['medium']['height'], 'medium'); $images['pnglarge'] = $pngimage->get_resized_image($ihConf['large']['width'], $ihConf['large']['height'], 'large'); $jpgimage = new ih_image(basename($ihConf['dir']['admin']) . "/" . 'images/ih-test.jpg', intval($ihConf['small']['width']), intval($ihConf['small']['height'])); $images['jpgsource'] = $jpgimage->get_resized_image(intval($ihConf['small']['width']), intval($ihConf['small']['height']), 'orig'); $images['jpgsmall'] = $jpgimage->get_resized_image($ihConf['small']['width'], $ihConf['small']['height'], 'small'); $images['jpgmedium'] = $jpgimage->get_resized_image($ihConf['medium']['width'], $ihConf['medium']['height'], 'medium'); $images['jpglarge'] = $jpgimage->get_resized_image($ihConf['large']['width'], $ihConf['large']['height'], 'large'); $gifimage = new ih_image(basename($ihConf['dir']['admin']) . "/" . 'images/ih-test.gif', intval($ihConf['small']['width']), intval($ihConf['small']['height'])); $images['gifsource'] = $gifimage->get_resized_image(intval($ihConf['small']['width']), intval($ihConf['small']['height']), 'orig'); $images['gifsmall'] = $gifimage->get_resized_image($ihConf['small']['width'], $ihConf['small']['height'], 'small'); $images['gifmedium'] = $gifimage->get_resized_image($ihConf['medium']['width'], $ihConf['medium']['height'], 'medium'); $images['giflarge'] = $gifimage->get_resized_image($ihConf['large']['width'], $ihConf['large']['height'], 'large'); ?> <table style="background-color:#F5F5F5" cellspacing="0" cellpadding="5px" border="0"> <tr> <th style="border-bottom: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC"><?php echo IH_SOURCE_TYPE; ?> </th> <th style="border-bottom: 1px solid #CCCCCC"><?php echo IH_SOURCE_IMAGE; ?> </th>
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 } } }