陈奇网络工作室

如何解决PHPCMS缩略图不清晰问题

建设工作站服务器

本文介绍了如何解决PHPCMS缩略图中的不明确问题。 代码简洁易懂,绝对能让眼前一亮。 希望通过本文的详细介绍,你能得到。

首先在phpcms下的libs中找到并打开classes目录; 然后找到并打开“image.class.php”文件; 最后,您只需找到要调用" $imagefun ( ) "函数的位置,并告诉它第三个参数是90即可。

查找下一个函数

functionthumb($image,$filename=& #039;$maxwidth=200,$maxheight=200,$suffix=& #039; & #039;$autocut=0,$ftp=0

if (! $this-thumb_enable ||! $this-check($image ) )返回假;

$info=image:info($image;

if($info===false ) return false;

$srcwidth=$info[& #039; width& #039; ];

$srcheight=$info[& #039; height& #039; ];

$pathinfo=pathinfo($image );

$type=$pathinfo[& #039; 扩展和映射; #039; ];

if (! $type$type=$info[& #039; type& #039; ];

$type=strtolower($type;

unset($info;

$ creat _ arr=$ this-get percent ( $ src width,$srcheight,$maxwidth,$maxheight );

$ create width=$ width=$ creat _ arr [ & amp; #039; w& #039; ];

$ create height=$ height=$ creat _ arr [ & amp; #039; h& #039; ];

$psrc_x=$psrc_y=0;

if $ autocut $ maxwidth0$ max height0} {

if ( $ maxwidth/$ max height $ src width/$ src height $ max height=$ height ) {

$ width=$ max height/$ height * $ width;

$height=$maxheight;

} else if ( $ maxwidth/$ max height $ src width/$ src height $ maxwidth=$ width ) ) ) ) ) ) ) )

$ height=$ maxwidth/$ width * $ height;

$width=$maxwidth;

}

$createwidth=$maxwidth;

$createheight=$maxheight;

}

$createfun=& #039; imagecreatefrom& #039; ( $type==& #039; jpg& #039; & #039; jpeg& #039; $type;

$srcimg=$createfun($image );

if($type!=& #039; gif& #039; 函数_ exists ( imagecreate true color ) )

$ thumb img=imagecreate true color ( $ createwidth,$createheight );

else

$thumbimg=imagecreate($width,$height;

function _ exists ( imagecopyresampled ) )

imagecopyresampled($thumbimg,$srcimg,0,0,$psrc_x,$psrc_y,$width,$height,$srcwidth,$srcheight

else

imagecopyresized($thumbimg,$srcimg,0,0,$psrc_x,$psrc_y,$width,$height,$srcwidth,$srcheight )

if($type==& #039; gif& #039; |$type=& #039; png& #039; ) }

$ background _ color=imagecolorallocate ( $ thumb img,0,255,0 ); //分配绿色

imagecolortransparent ( $ thumb img,$background_color ); //设置为透明色,注释掉该行,将输出绿色的图

}

if($type==& #039; jpg& #039; || $type==& #039; jpeg& #039; ) imageinterlace($thumbimg,$this-interlace );

$imagefun=& #039; image& #039; ( $type==& #039; jpg& #039; & #039; jpeg& #039; $type;

if(empty ) $filename ) ) $filename=substr ) $image,0,strrpos ) $image,& #039; & #039; ) ).$suffix.& #039; & #039; $type;

$imagefun($thumbimg,$filename );

imagedestroy($thumbimg;

imagedestroy($srcimg;

if($FTP ) {

@unlink($image;

}

返回$ filename;

}

然后你就会找到

if($type==& #039; jpg& #039; || $type==& #039; jpeg& #039; ) imageinterlace($thumbimg,$this-interlace );

$imagefun=& #039; image& #039; ( $type==& #039; jpg& #039; & #039; jpeg& #039; $type;

if(empty ) $filename ) ) $filename=substr ) $image,0,strrpos ) $image,& #039; & #039; ) ).$suffix.& #039; & #039; $type;

$imagefun($thumbimg,$filename );

imagedestroy($thumbimg;

imagedestroy($srcimg;

中选择另一种天花板类型

if($type==& #039; jpg& #039; || $type==& #039; jpeg& #039; ) imageinterlace($thumbimg,$this-interlace );

$imagefun=& #039; image& #039; ( $type==& #039; jpg& #039; & #039; jpeg& #039; $type;

if(empty ) $filename ) ) $filename=substr ) $image,0,strrpos ) $image,& #039; & #039; ) ).$suffix.& #039; & #039; $type;

$imagefun($thumbimg,$filename,90 );

imagedestroy($thumbimg;

imagedestroy($srcimg;

以上内容是如何解决PHPCMS缩略图不清晰的问题,你学到知识和技能了吗? 如果你想掌握更多技能或积累知识,请关注信息频道。

详情请访问云服务器、域名注册、虚拟主机的问题,请访问西部数码代理商官方网站: www.chenqinet.cn

相关推荐

后台-系统设置-扩展变量-手机广告位-内容页底部广告位3