如何解决PHPCMS缩略图不清楚的问题
发表于:2025-12-02 作者:千家信息网编辑
千家信息网最后更新 2025年12月02日,本篇文章为大家展示了如何解决PHPCMS缩略图不清楚的问题,代码简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。首先在phpcms下面的libs中找到classes目
千家信息网最后更新 2025年12月02日如何解决PHPCMS缩略图不清楚的问题
本篇文章为大家展示了如何解决PHPCMS缩略图不清楚的问题,代码简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。
首先在phpcms下面的libs中找到classes目录并打开;然后找到"image.class.php"这个文件并打开;最后搜索到调用"$imagefun()"函数的地方并传第三个参数为90即可。
搜索到下这个函数
function thumb($image, $filename = '', $maxwidth = 200, $maxheight = 200, $suffix='', $autocut = 0, $ftp = 0) { if(!$this->thumb_enable || !$this->check($image)) return false; $info = image::info($image); if($info === false) return false; $srcwidth = $info['width']; $srcheight = $info['height']; $pathinfo = pathinfo($image); $type = $pathinfo['extension']; if(!$type) $type = $info['type']; $type = strtolower($type); unset($info); $creat_arr = $this->getpercent($srcwidth,$srcheight,$maxwidth,$maxheight); $createwidth = $width = $creat_arr['w']; $createheight = $height = $creat_arr['h']; $psrc_x = $psrc_y = 0; if($autocut && $maxwidth > 0 && $maxheight > 0) { if($maxwidth/$maxheight<$srcwidth/$srcheight && $maxheight>=$height) { $width = $maxheight/$height*$width; $height = $maxheight; }elseif($maxwidth/$maxheight>$srcwidth/$srcheight && $maxwidth>=$width) { $height = $maxwidth/$width*$height; $width = $maxwidth; } $createwidth = $maxwidth; $createheight = $maxheight; } $createfun = 'imagecreatefrom'.($type=='jpg' ? 'jpeg' : $type); $srcimg = $createfun($image); if($type != 'gif' && function_exists('imagecreatetruecolor')) $thumbimg = imagecreatetruecolor($createwidth, $createheight); else $thumbimg = imagecreate($width, $height); if(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=='gif' || $type=='png') { $background_color = imagecolorallocate($thumbimg, 0, 255, 0); // 指派一个绿色 imagecolortransparent($thumbimg, $background_color); // 设置为透明色,若注释掉该行则输出绿色的图 } if($type=='jpg' || $type=='jpeg') imageinterlace($thumbimg, $this->interlace); $imagefun = 'image'.($type=='jpg' ? 'jpeg' : $type); if(empty($filename)) $filename = substr($image, 0, strrpos($image, '.')).$suffix.'.'.$type; $imagefun($thumbimg, $filename); imagedestroy($thumbimg); imagedestroy($srcimg); if($ftp) { @unlink($image); } return $filename; }然后找到
if($type=='jpg' || $type=='jpeg') imageinterlace($thumbimg, $this->interlace);$imagefun = 'image'.($type=='jpg' ? 'jpeg' : $type);if(empty($filename)) $filename = substr($image, 0, strrpos($image, '.')).$suffix.'.'.$type;$imagefun($thumbimg, $filename);imagedestroy($thumbimg);imagedestroy($srcimg);
改为
if($type=='jpg' || $type=='jpeg') imageinterlace($thumbimg, $this->interlace);$imagefun = 'image'.($type=='jpg' ? 'jpeg' : $type);if(empty($filename)) $filename = substr($image, 0, strrpos($image, '.')).$suffix.'.'.$type;$imagefun($thumbimg, $filename, 90);imagedestroy($thumbimg);imagedestroy($srcimg);
上述内容就是如何解决PHPCMS缩略图不清楚的问题,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注行业资讯频道。
清楚
问题
函数
技能
知识
绿色
搜索
简明
简明扼要
三个
代码
内容
参数
地方
就是
文件
文章
更多
注释
目录
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
徐汇区个人数据库服务商销售价格
上海鸣歧网络技术有限公司
数据库表结构及关系
量学数据库
三级网络技术要刷多少套
电脑sql服务器管理器
数据库方面的个人评价
山西信安华普网络技术有限公司
黑龙江海康软件开发业绩报告
什么是edr网络安全
网络安全审计系统执行标准
星鼎源天津网络技术有限公司
全国等级等级考试网络技术
数据库的代码可以用中文写吗
as 服务器
华为数据库审计2500
小米游戏怎么查看以前服务器
上海本地网络技术厂家现货
网络安全是绝对的对吗
日照网络安全
小型ibm服务器组装
土豆服务器网速是多少
防护防盗网络安全教育视频
震声科技互联网定制专家
网络安全宣传周2020文章
炫舞服务器怎么获得
网络安全监测装置的创新应用
数通工程师与软件开发工程师
奥的斯用服务器做
r220服务器评测