您现在的位置是:首页 > 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);
即可解决问题
本文标签:
很赞哦! ()
相关教程
图文教程
phpcmsv9常用标签终结
action="position"-------------对话框的类型=“内容推荐位列表”posid="9"--------------------推荐位ID=“9”order="id"--------------------排序类型=“id”
phpcms生成缩略图失败的解决方法
phpcms生成缩略图失败解决方法:首先打开“phpcms/modules/attachment/attachments.php”文件;然后将第50行的判断,进行注释或删除即可,其原因是判断的值有可能为空
phpcms插件开发初步规范
(一)./include/global.php 中的函数可在phpcms的任何一个程序中调用,下面是各函数的原型及用法。
PHPCM V9站群功能建立分站的方法
用一套CMS软件系统,做多个网站,统一管理,用户可以互通,这就是所谓的站群功能。这对于运营和维护都能节省很多时间,否则要同时调试和维护不同系统会非常吃力。
相关源码
-
帝国cms淘宝客京东联盟网站整站源码下载本模板基于帝国CMS内核深度开发,为淘宝客行业量身定制。随着腾讯微信与淘宝生态的互联互通,淘宝客链接现可在微信、QQ等平台直接分享,为推广带来更多便利。模板特别优化了店铺推广功能,有效避免商品下架导致的链接失效问题,同时支持京东联盟等多平台商品推广。查看源码 -
(自适应)WordPress主题SEO自媒体博客资讯模板RabbitV2.0Rabbit v2.0主题专注于网站搜索引擎优化需求,为博客、自媒体及资讯类网站提供专业的SEO技术解决方案。该主题从架构设计到功能实现均围绕搜索引擎优化理念展开。查看源码 -
响应式艺考培训学校机构pbootcms模板html5源码基于PbootCMS免费开源内核开发,为艺考培训学校与艺术机构设计,替换图文即可快速适配全行业需求。响应式布局兼容手机/PC端,数据实时同步,运维效率提升300%。查看源码 -
(自适应)绿色园林建筑花卉园艺艺术模板免费下载为景观设计及园艺企业打造的响应式网站框架,基于PbootCMS系统开发,帮助传统园林行业建立现代化数字展示平台。采用标准DIV+CSS前端架构,代码精简无冗余。查看源码 -
(PC+WAP)安保服务保安保镖模板免费下载本模板基于PbootCMS内核开发,为安保服务企业量身打造。设计风格严谨专业,突出安保行业的安全、可靠特性,展示企业服务项目与实力。采用响应式设计,PC与移动端数据同步,管理便捷。模板布局合理查看源码 -
(自适应响应式)英文外贸电子产品手机配件网站pbootcms模板专业级外贸网站模板基于PbootCMS内核开发,为电子产品跨境贸易企业设计。采用响应式布局技术,确保电脑、平板、手机等设备访问时自动适配显示效果。数据实时同步管理,一次编辑全平台生效。查看源码
| 分享笔记 (共有 篇笔记) |
