<var id="xvh3p"><noframes id="xvh3p"><var id="xvh3p"></var><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing>
<var id="xvh3p"><strike id="xvh3p"><var id="xvh3p"></var></strike></var><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<span id="xvh3p"><noframes id="xvh3p"><dl id="xvh3p"></dl>
<span id="xvh3p"><noframes id="xvh3p">
<dl id="xvh3p"><noframes id="xvh3p">
<listing id="xvh3p"><noframes id="xvh3p"><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<th id="xvh3p"><strike id="xvh3p"></strike></th>
<dl id="xvh3p"><noframes id="xvh3p">
<th id="xvh3p"><noframes id="xvh3p">

观点

互联网+时代,说建站,谈运营与网络营销

修改DEDE自动生成的缩略图函数

时间:2020-12-21

DEDECMS自动生成的缩略图片其实是根据自定义的最大长宽,原比例的缩小原图片,不利于图片索引页排版,不得已CSS里采用了自动判断调整高宽---但比较耗资源。所以还是决定改改缩图函数----再次感谢DEDE的开源!!

修改文件:image.func.php(或inc_photograph.php)

if($toWH<=$srcWH){
$ftoW=$toW;
$ftoH=$ftoW*($srcH/$srcW);
}
else{
$ftoH=$toH;
$ftoW=$ftoH*($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;
}
 

($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH)

更改为

($ni,$im,0,0,$src_X,$src_Y,$ftoW,$ftoH,$srcW,$srcH)

其实就一小小改动,就是在原图中截取最大面积的符合自定义缩略图长宽比列的一部分生成缩略图。

0
首页
案例
关于
联系