織夢(mèng)圖集 上傳圖片小于設(shè)定尺寸 縮略圖生成失敗的解決辦法_DedeCms教程
教程Tag:暫無(wú)Tag,歡迎添加,賺取U幣!
織夢(mèng)圖集中,上傳的圖片像素寬高小于系統(tǒng)設(shè)置定的這個(gè)尺寸:
較小的這些圖片就會(huì)無(wú)法生成縮略圖,導(dǎo)致圖集在網(wǎng)頁(yè)上縮略圖顯示X叉號(hào),這應(yīng)該是織夢(mèng)DEDEcms的一個(gè)歷史遺漏bug,可用下面方法修復(fù)。
/include/helpers/,這個(gè)文件中搜索,下面的代碼:
- if($srcW<=$toW && $srcH<=$toH ) return TRUE;
- $toWH=$toW/$toH;
- $srcWH=$srcW/$srcH;
- if($toWH<=$srcWH)
- {
- $ftoW=$toW;
- $ftoH=$ftoW*($srcH/$srcW);
- }
- else
- {
- $ftoH=$toH;
- $ftoW=$ftoH*($srcW/$srcH);
- }
然后用下面的大片代碼替換:
- $ftoW=$toH;
- [size=; font-size: inherit,inherit] $ftoH=$toH;
- ///
- [size=; font-size: inherit,inherit] if( $srcH<=$toH && $srcW<=$toW )
- [size=; font-size: inherit,inherit] {
- [size=; font-size: inherit,inherit] $ftoW=$srcW;
- [size=; font-size: inherit,inherit] $ftoH=$srcH;
- [size=; font-size: inherit,inherit] if(function_exists("imagecreatetruecolor"))
- [size=; font-size: inherit,inherit] {
- [size=; font-size: inherit,inherit] @$ni = imagecreatetruecolor($ftoW,$ftoH);
- [size=; font-size: inherit,inherit] if($ni)
- [size=; font-size: inherit,inherit] {
- [size=; font-size: inherit,inherit] imagecopyresampled($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH);
- [size=; font-size: inherit,inherit] }
- [size=; font-size: inherit,inherit] else
- [size=; font-size: inherit,inherit] {
- [size=; font-size: inherit,inherit] $ni=imagecreate($ftoW,$ftoH);
- [size=; font-size: inherit,inherit] imagecopyresized($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH);
- [size=; font-size: inherit,inherit] }
- [size=; font-size: inherit,inherit] }
- [size=; font-size: inherit,inherit] else
- [size=; font-size: inherit,inherit] {
- [size=; font-size: inherit,inherit] $ni=imagecreate($ftoW,$ftoH);
- [size=; font-size: inherit,inherit] imagecopyresized($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH);
- [size=; font-size: inherit,inherit] }
- [size=; font-size: inherit,inherit] switch ($srcInfo[2])
- [size=; font-size: inherit,inherit] {
- [size=; font-size: inherit,inherit] case 1:
- [size=; font-size: inherit,inherit] imagegif($ni,$toFile);
- [size=; font-size: inherit,inherit] break;
- [size=; font-size: inherit,inherit] case 2:
- [size=; font-size: inherit,inherit] imagejpeg($ni,$toFile,100);
- [size=; font-size: inherit,inherit] break;
- [size=; font-size: inherit,inherit] case 3:
- [size=; font-size: inherit,inherit] imagepng($ni,$toFile);
- [size=; font-size: inherit,inherit] break;
- [size=; font-size: inherit,inherit] case 6:
- [size=; font-size: inherit,inherit] imagebmp($ni,$toFile);
- [size=; font-size: inherit,inherit] break;
- [size=; font-size: inherit,inherit] default:
- [size=; font-size: inherit,inherit] return false;
- [size=; font-size: inherit,inherit] }
- [size=; font-size: inherit,inherit] imagedestroy($ni);
- [size=; font-size: inherit,inherit] } ///
- $toWH=$toW/$toH;
- $srcWH=$srcW/$srcH;
- if($toWH<=$srcWH)
- {
- $ftoW=$toW;
- $ftoH=$ftoW*($srcH/$srcW);
- }
- else
- {
- $ftoH=$toH;
- $ftoW=$ftoH*($srcW/$srcH);
- }
這樣織夢(mèng)上傳的圖,就不會(huì)顯示x號(hào)了。希望可以幫助到你。
查看更多 DedeCms教程 織夢(mèng)模板 織夢(mèng)DedeCms視頻教程 織夢(mèng)dedecms專(zhuān)題
相關(guān)DedeCms教程:
- 織夢(mèng)cms系統(tǒng)TAG標(biāo)簽和分頁(yè)偽靜態(tài)設(shè)置教程
- dedecms在首頁(yè)調(diào)用會(huì)員信息(會(huì)員頭像和名字等)
- dede搜索結(jié)果頁(yè)支持article、sql、channelartlist 等標(biāo)簽
- 織夢(mèng)cms批量取消審核文檔的實(shí)現(xiàn)方法
- 織夢(mèng)dedecms在模板頁(yè)面中實(shí)現(xiàn)會(huì)員登錄退出狀態(tài)顯示
- 織夢(mèng)dedecms使用Mysql8.0無(wú)法登錄后臺(tái)的解決辦法
- 織夢(mèng)上傳本地視頻后 文件管理器中不顯示解決辦法
- DEDECMS織夢(mèng)內(nèi)容頁(yè)調(diào)用seotitle標(biāo)題的寫(xiě)法
- 將織夢(mèng)DEDECMS的驗(yàn)證碼改為數(shù)字
- 兩種可以實(shí)現(xiàn)DEDECMS欄目統(tǒng)計(jì)功能的方法
- 教你實(shí)現(xiàn)DEDECMS織夢(mèng)自動(dòng)錨文本
- DEDECMS專(zhuān)題不能選取一級(jí)欄目的解決方案
DedeCms教程教程Rss訂閱Cms教程搜索
DedeCms教程推薦
- 織夢(mèng)CMS批量替換所有文章來(lái)源和作者的方法
- 織夢(mèng)DedeCMS網(wǎng)站服務(wù)器搬家詳細(xì)教程
- dedecms編碼轉(zhuǎn)換方法 gbk轉(zhuǎn)UTF-8,UTF-8轉(zhuǎn)GBK
- DEDECMS欄目目錄名優(yōu)化方案
- 織夢(mèng)DEDECMS網(wǎng)站內(nèi)容頁(yè)、欄目頁(yè)獲取當(dāng)前頂級(jí)欄目名稱(chēng)標(biāo)簽
- 織夢(mèng)DedeCMS模板及系統(tǒng)程序編碼轉(zhuǎn)換的方法
- 讓游客也能發(fā)布分類(lèi)信息
- dedecms指定欄目搜索和按欄目分類(lèi)搜索下拉
- 二次開(kāi)發(fā) 全站收藏總次數(shù)統(tǒng)計(jì)
- DEDECMS附件按月保存,修改DEDE附件不按天保存
猜你也喜歡看這些
- DEDE高仿酷友網(wǎng)/QQ網(wǎng)名文章圖片站模板
- dedecms織夢(mèng)藍(lán)色企業(yè)網(wǎng)站模板
- HTML5響應(yīng)式模板/素材網(wǎng)站織夢(mèng)模板(自適應(yīng))
- 精仿大前端DUX主題織夢(mèng)模板(多設(shè)備支持)
- 織夢(mèng)cms教育輔導(dǎo)培訓(xùn)機(jī)構(gòu)學(xué)校企業(yè)網(wǎng)站模板 (帶數(shù)據(jù))
- 女性門(mén)戶(hù)資訊類(lèi)網(wǎng)站織夢(mèng)dedecms模板
- 織夢(mèng)html5品牌公司企業(yè)集團(tuán)網(wǎng)站模板(帶測(cè)試數(shù)據(jù))
- dedecms二手回收物資企業(yè)站模版
- 織夢(mèng)dedecms文章模板博客模板-可自定義顏色
- DEDECMS模板_綠色花卉模板_5.7GBK
- 相關(guān)鏈接:
復(fù)制本頁(yè)鏈接| 搜索織夢(mèng)圖集 上傳圖片小于設(shè)定尺寸 縮略圖生成失敗的解決辦法| DedeCms模板| Dede模板| 織夢(mèng)模板| dedecms
- 教程說(shuō)明:
DedeCms教程-織夢(mèng)圖集 上傳圖片小于設(shè)定尺寸 縮略圖生成失敗的解決辦法
。