關(guān)于織夢縮略圖的解決方法,織夢文章
導(dǎo)讀:織夢文章織夢文章有時(shí)候縮略圖很頭疼,要么變形了,要么就是拉長了,今天就針對這個(gè)問題說個(gè)解決方法。 首先找到以下代碼: /includes/image.func.php目錄下修改dede手機(jī)模板。
有時(shí)候縮略圖很頭疼,要么變形了,要么就是拉長了,今天就針對這個(gè)問題說個(gè)解決方法。首先找到以下代碼:/includes/image.func.php目錄下修改74行為以下代碼:function ImageResize($srcFile,$toW,$toH,$toFile=""){global $cfg_photo_type;if($toFile==""){$toFile = $srcFile;}$info = "";$srcInfo = GetImageSize($srcFile,$info);switch ($srcInfo[2]){case 1:if(!$cfg_photo_type['gif']){return false;}$im = imagecreatefromgif($srcFile);break;case 2:if(!$cfg_photo_type['jpeg']){return false;}$im = imagecreatefromjpeg($srcFile);break;case 3:if(!$cfg_photo_type['png']){return f織夢模板網(wǎng)站alse;}$im = imagecreatefrompng($srcFile);break;case 6:if(!$cfg_photo_type['bmp']){return false;}$im = imagecreatefromwbmp($srcFile);break;}$srcW=ImageSX($im);$srcH=ImageSY($im);if($srcW<=$toW && $srcH<=$toh neww="$toH" newh="$toW">= $toH){$ftoW = $toW;$ftoH = $newH;}else{$ftoW = $newW;$ftoH = $toH; }if($srcW>$toW||$srcH>$toH){if(function_exists("imagecreatetruecolor")){@$ni = imagecreatetruecolor($ftoW,$ftoH);if($ni){imagecopyresampled($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH);}else{$ni=imagecreate($ftoW,$ftoH);imagecopyresized($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH);}}else{$ni=imagecreate($ftoW,$ftoH);imagecopyresized($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH);}//裁剪圖片成標(biāo)準(zhǔn)縮略圖$new_imgx = imagecreatetruecolor($toW,$toH);if($newH >= $toH){imagecopyresampled($new_imgx,$ni,0,0,0,($newH - $toH)/2,$toW,$toH,$toW,$toH);}else{imagecopyresampled($new_imdede模板免費(fèi)gx,$ni,0,0,($newW - $toW)/2,0,$toW,$toH,$toW,$toH);}switch ($srcInf織夢的模板o[2]){case 1:imagegif($new_imgx,$toFile);break;case 2:imagejpeg($new_imgx,$toFile,85);break;case 3:imagepng($new_imgx,$toFile);break;case 6:imagebmp($new_imgx,$toFile);break;default:return false;}imagedestroy($new_imgx);imagedestroy($ni);}imagedestroy($im);return true;}覆蓋即可。這樣就可以了!
相關(guān)dede手機(jī)模板。聲明: 本文由我的SEOUC技術(shù)文章主頁發(fā)布于:2023-07-21 ,文章關(guān)于織夢縮略圖的解決方法,織夢文章主要講述解決方法,縮略圖,織夢網(wǎng)站建設(shè)源碼以及服務(wù)器配置搭建相關(guān)技術(shù)文章。轉(zhuǎn)載請保留鏈接: http://www.bifwcx.com/article/web_32750.html
為你推薦與關(guān)于織夢縮略圖的解決方法,織夢文章相關(guān)的文章
-
dedecms首頁中文章列表無刷新頂、踩的實(shí)現(xiàn)
(120)人喜歡 2023-07-21 -
織夢網(wǎng)站地圖Sitemap+百度Ping推送功能實(shí)現(xiàn)
(160)人喜歡 2023-07-21 -
DeDecms后臺設(shè)置及網(wǎng)站地圖seo優(yōu)化,織夢技
(50)人喜歡 2023-07-21 -
DedeCMS模板制作自定義表單時(shí)添加驗(yàn)證碼的
(166)人喜歡 2023-07-21 -
織夢標(biāo)簽:sonchannel 子欄目調(diào)用,織夢教程
(103)人喜歡 2023-07-21 -
在織夢cms中使用繁體轉(zhuǎn)簡體的函數(shù)BIG5To
(186)人喜歡 2023-07-21