oscommerce:将缩略图更改为原始产品图像

发布于 2024-08-26 02:32:49 字数 56 浏览 6 评论 0原文

我不想将新产品图像更改为原始图像。

当我上传产品图片时,图片被压缩,有什么帮助吗?

i want ot change new product images prospective to original images.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眸中客 2024-09-02 02:32:49

我们修改了 tep_image 函数以接受 -1,这意味着它将仅输出“高度”或“宽度”约束,但不会同时输出两者。您可以根据自己的喜好修改它,但您想查看 include/functions/html_output.php 中的 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;
  }

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;
  }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文