FWQ
phpcms怎么压缩图片
phpcms压缩图片的方法:首先找到并打开“extention.func.php”文件;然后在公共类中写一个自动压缩的方法;最后通过语句“{compress ($rs[‘thumb’])}”在html页面中直接调用即可。 图片自动压缩功能 在公共类中写一个自动压缩的方法: phpcmslibsunctionsextention.func.php ** @param $imgName @return mixed|string $imgpath 原图存放地址 $thumbpath 压缩后图片存放路径 */ function compress ($imgName){ imgPath=PHPCMSPATH.trim(imgPath = PHPCMS_PATH . trim(imgPath=PHPCMS P ATH.trim(imgName, ‘/’); $Patharray = explode(’/’, $imgName); fileName=end(fileName = end(fileName=end(Patharray); //创建thumb文件夹,保存压缩后的图片 header(“Content-type:text/html;charset=utf-8”); $path="/uploadfile/thumb/"; dirPath=PHPCMSPATH.dirPath = PHPCMS_PATH.dirPath=PHPCMS P ATH.path; if(!is_dir(KaTeX parse error: Expected '}', got 'EOF' at end of input: …h)){ mkdir(dirPath,0777,true); } $thumbPath = PHPCMS_PATH . ‘uploadfile/thumb/’ . fileName;if(fileexists(fileName;if (file_exists(fileName;if(file e xists(thumbPath)) {…