您现在的位置是:首页 > cms教程 > phpcms教程phpcms教程
PHPCMS缩略图不清楚怎么办
翠风2025-04-28phpcms教程已有人查阅
导读PHPCMS如何解决缩略图不清楚,首先在phpcms下面的libs中找到classes目录并打开;然后找到“image.class.php”这个文件并打开;最后搜索到调用“$imagefun()”
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=$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万能字段使用php的方法
phpcms后台内容模块->模型管理->添加字段功能很强大,你只需在phpcms的后台面板进行操作,不用在数据库中手动建表,也不用操作数据库增加或删除字段
phpcms后台访问限制的实现方法
文件路径:/caches/config/system.php比如:后台需要绑定的域名是,ebingou.cn,那么我们只能通过http://ebingou.cn/admin.php来访问后台。
phpcmsv9开源开发框架基础mvc介绍
根据对mvc的了解简要写个mvc框架 也谈不上框架 希望对新手有帮助简单的解析下mvc你可以这样了解 m模型也就是数据库操作 v视图c控制器 通过url来判断调用m和v来完成请求
PHPCMS源码构造分析
pc_base::creat_app()主要工作就是把application这个类初始化。application类的初始化到底干了些什么呢,我们研究一下。
相关源码
-
(自适应响应式)宠物经验资讯咨询博客pbootcms网站源码下载除宠物资讯领域外,通过内容替换可快速适配宠物用品商城、宠物医疗咨询平台、宠物训练教程网站、动物保护组织官网、水族爱好者社区等垂直领域。查看源码 -
(自适应)挖掘机大型采矿设备pbootcms网站源码下载本模板基于PbootCMS系统开发,专为重型机械设备行业设计,特别适合挖掘机、采矿设备、工程机械等工业设备展示。采用响应式布局技术,确保各类设备参数和图片在不同终端上都能清晰展示。查看源码 -
(PC+WAP)生活资讯百科新闻门户类pbootcms网站模板为生活资讯、百科门户类企业打造的高性能网站模板,基于PbootCMS开源内核开发,采用HTML5响应式架构,PC与手机端实时数据同步,覆盖全终端用户浏览场景。查看源码 -
(PC+WAP)盆栽绿植观赏植物花卉租赁免费pbootcms网站模板为花卉盆栽租赁、园林绿化企业打造的PbootCMS网站模板,采用较新内核开发,PC与移动端数据实时同步。通过清新自然的视觉设计,精准展现植物养护、花卉展示等业务场景,帮助用户快速建立专业级行业网站。查看源码 -
(PC+WAP)红色厨具厨房用品设备pbootcms模板源码下载为厨具设备企业设计的响应式网站模板,采用PbootCMS内核开发,适用于商用厨房设备、家用厨具、厨房用品等企业展示。模板包含产品展示、新闻动态、案例中心等标准模块,助您快速搭建专业级行业网站。查看源码 -
(自适应)英文外贸电子设备网站模板三级子目录基于PbootCMS内核开发的响应式英文网站模板,为外贸企业打造,支持多行业快速适配。通过简洁高效的代码架构,帮助企业低成本构建专业海外形象,实现更好客户触达与订单转化。查看源码
| 分享笔记 (共有 篇笔记) |
