开发者

oscommerce : Change thumb image prospactive to Original product image

开发者 https://www.devze.com 2022-12-22 21:35 出处:网络
i want ot change new productimages prospective to or开发者_运维问答iginal images. when i am upload image for product , images are squazed so any help?We modified the tep_image function to accept -1 w

i want ot change new product images prospective to or开发者_运维问答iginal images.

when i am upload image for product , images are squazed so any help?


We modified the tep_image function to accept -1 which means it will only output a "height" or a "width" constraint but not both. You can modify this to your liking but you want to look at includes/functions/html_output.php for tep_image()

    // The HTML image wrapper function
  function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
    if ( (empty($enter code heresrc) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
      return false;
    }

    if($src=='images/')
        $src='images/noimage.jpg';
// 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="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';

    if (tep_not_null($alt)) {
      $image .= ' title=" ' . tep_output_string($alt) . ' "';
    }
        if(((int)$height==-1) && ((int)$width)==-1){
          $image .= '';
        }elseif((!empty($width) && ((int)$height)==-1)){
          $image .= ' width="' . tep_output_string($width) . '" ';
        }elseif((!empty($height) && ((int)$width)==-1)){
          $image .= ' height="' . tep_output_string($height) . '" ';
        }else{
            if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
              if ($image_size = @getimagesize($src)) {
                if (empty($width) && tep_not_null($height)) {
                  $ratio = $height / $image_size[1];
                  $width = intval($image_size[0] * $ratio);
                } elseif (tep_not_null($width) && empty($height)) {
                  $ratio = $width / $image_size[0];
                  $height = intval($image_size[1] * $ratio);
                } elseif (empty($width) && empty($height)) {
                  $width = $image_size[0]; 
                  $height = $image_size[1];
                }
              } elseif (IMAGE_REQUIRED == 'false') {
                return false;
              }
            }
            if (tep_not_null($width) && tep_not_null($height)) {
              $image .= ' wddidth="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"';
            }
        }  

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

    $image .= '>';

    return $image;
  }
0

精彩评论

暂无评论...
验证码 换一张
取 消