Just beginning to use Dede soon, the initial collection found that automatically generated thumbnail image is based on the maximum length of the custom, the original proportion of the reduction of the original picture, is not conducive to the image index page layout, forced to use the CSS in the automatic Judgment adjustment width-but more resource consumption. So still decided to change the function of the thumbnail--again thanks to Dede Open source!!
Modify File: inc_photograph.php
Copy Code code as follows:
if ($toWH <= $srcWH) {
$ftoW = $toW;
$ftoH = $ftoW * ($srcH/$srcW);
}
else{
$ftoH = $toH;
$ftoW = $ftoH * ($srcW/$srcH);
}
Change to
Copy Code code as follows:
$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;
}
Key points:
Copy Code code as follows:
($ni, $im, 0,0,0,0, $ftoW, $ftoH, $srcW, $srcH)
Change to
Copy Code code as follows:
($ni, $im, 0,0, $src _x, $src _y, $ftoW, $ftoH, $srcW, $srcH)
In fact, a small change, that is, in the original image to intercept the largest area of the custom thumbnail aspect ratio of the column to generate thumbnails.