织梦DedeCms5.7缩略图变形解决方法

COS、CDN
  1. 修改 image.helper.php 文件
    • 找到以下代码:
      $srcW = ImageSX($im); $srcH = ImageSY($im); if($srcW <= $toW && $srcH <= $toH) return TRUE; $toWH = $toW / $toH; $srcWH = $srcW / $srcH; if($toWH <= $srcWH) {     $ftoW = $toW;     $ftoH = $ftoW * ($srcH / $srcW); } else {     $ftoH = $toH;     $ftoW = $ftoH * ($srcW / $srcH); }
    • 修改为:
      $srcW = ImageSX($im); $srcH = ImageSY($im); if($srcW <= $toW && $srcH <= $toH) return TRUE; $toWH = $toW / $toH; $srcWH = $srcW / $srcH; $ftoH = $toH; $ftoW = $toW; if ($toWH <= $srcWH) {     $src_Y = 0;     $src_X = ($srcW - $srcH * $toWH) / 2;     $srcW = $srcH * $toWH; } else {     $src_X = 0;     $src_Y = ($srcH - $srcW / $toWH) / 2;     $srcH = $srcW / $toWH; }

       

COS、CDN
热门