|
织梦图集中,上传的图片像素宽高小于系统设置定的这个尺寸:
较小的这些图片就会无法生成缩略图,导致图集在网页上缩略图显示X叉号,这应该是织梦DEDEcms的一个历史遗漏bug,可用下面方法修复。
/include/helpers/,这个文件中搜索,下面的代码:
if($srcW
$toWH=$toW/$toH;
$srcWH=$srcW/$srcH;
if($toWH
{
$ftoW=$toW;
$ftoH=$ftoW*($srcH/$srcW);
}
else
{
$ftoH=$toH;
$ftoW=$ftoH*($srcW/$srcH);
}
然后用下面的大片代码替换:
$ftoW=$toH;
[size=; font-size: inherit,inherit, $ftoH=$toH;
///
[size=; font-size: inherit,inherit, if( $srcH
[size=; font-size: inherit,inherit, {
[size=; font-size: inherit,inherit, $ftoW=$srcW;
[size=; font-size: inherit,inherit, $ftoH=$srcH;
[size=; font-size: inherit,inherit, if(function_exists("imagecreatetruecolor"))
[size=; font-size: inherit,inherit, {
[size=; font-size: inherit,inherit, @$ni = imagecreatetruecolor($ftoW,$ftoH);
[size=; font-size: inherit,inherit, if($ni)
[size=; font-size: inherit,inherit, {
[size=; font-size: inherit,inherit, imagecopyresampled($ni,$im,0,500]0,0]$ftoW,$ftoH,$srcW,$srcH);
[size=; font-size: inherit,inherit, }
[size=; font-size: inherit,inherit, else
[size=; font-size: inherit,inherit, {
[size=; font-size: inherit,inherit, $ni=imagecreate($ftoW,$ftoH);
[size=; font-size: inherit,inherit, imagecopyresized($ni,$im,0,500]0,0]$ftoW,$ftoH,$srcW,$srcH);
[size=; font-size: inherit,inherit, }
[size=; font-size: inherit,inherit, }
[size=; font-size: inherit,inherit, else
[size=; font-size: inherit,inherit, {
[size=; font-size: inherit,inherit, $ni=imagecreate($ftoW,$ftoH);
[size=; font-size: inherit,inherit, imagecopyresized($ni,$im,0,500]0,0]$ftoW,$ftoH,$srcW,$srcH);
[size=; font-size: inherit,inherit, }
[size=; font-size: inherit,inherit, switch ($srcInfo[2,)
[size=; font-size: inherit,inherit, {
[size=; font-size: inherit,inherit, case 1:
[size=; font-size: inherit,inherit, imagegif($ni,$toFile);
[size=; font-size: inherit,inherit, break;
[size=; font-size: inherit,inherit, case 2:
[size=; font-size: inherit,inherit, imagejpeg($ni,$toFile,100);
[size=; font-size: inherit,inherit, break;
[size=; font-size: inherit,inherit, case 3:
[size=; font-size: inherit,inherit, imagepng($ni,$toFile);
[size=; font-size: inherit,inherit, break;
[size=; font-size: inherit,inherit, case 6:
[size=; font-size: inherit,inherit, imagebmp($ni,$toFile);
[size=; font-size: inherit,inherit, break;
[size=; font-size: inherit,inherit, default:
[size=; font-size: inherit,inherit, return false;
[size=; font-size: inherit,inherit, }
[size=; font-size: inherit,inherit, imagedestroy($ni);
[size=; font-size: inherit,inherit, } ///
$toWH=$toW/$toH;
$srcWH=$srcW/$srcH;
if($toWH
{
$ftoW=$toW;
$ftoH=$ftoW*($srcH/$srcW);
}
else
{
$ftoH=$toH;
$ftoW=$ftoH*($srcW/$srcH);
}
这样织梦上传的图,就不会显示x号了。 |
|