帝国cms截图黑边解决办法

只有宽大于高(横片)的图片生成缩略图才会左右出现黑边,我们打开一张有黑边的图片,分析出得出图片是按照高度来缩放,宽度不足的话就用黑边填充。

打开e/class/gd.php,找到代码

if($big_width >= $max_width and $big_height >= $max_height)
{
if($big_width > $big_height)
{
$tempx = $max_width / $ratioh;
$tempy = $big_height;
$srcX = ($big_width – $tempx) / 2;
$srcY = 0;
}

替换成:

if($big_width >= $max_width and $big_height >= $max_height)
{
if($big_width > $big_height)
{
$tempy = $max_height / $ratiow;
$tempx = $big_width;
$srcY = ($big_height – $tempy) / 2;
$srcX = 0;
}