前面361源碼網給大家講了《DEDECMS整合百度瀏覽器教程》,細心的朋友可以發現了,在外面整合百度瀏覽器后,我們上傳圖片時候的路徑由原來的/uploads/allimg/bdimg,變成了"/Ueditor/php/upload"這個目錄下。
2017年8月10修改
為了統一想把ueditor編輯器所有上傳、遠程抓取的圖片都保存到"/uploads/allimg/bdimg"
優化dedecms整合ueditor后圖片上傳路徑
修改ueditor配置文件/include/ueditor/editor_config.js
找到:,imagePath:URL + "php/"
替換為:,imagePath:"/"
找到:,scrawlPath:URL+"php/"
替換為:,scrawlPath:"/"
找到:URL + "php/"
替換為:,filePath:"/"
找到:,catcherPath:URL + "php/"
替換為:,catcherPath:"/"
找到:,imageManagerPath:URL + "php/"
替換為:,imageManagerPath:"/"
找到:,snapscreenPath: URL + "php/"
替換為:,snapscreenPath: "/"
修改ueditor圖片上傳程序/include/ueditor/php/Uploader.class.php
找到:
$pathStr = $this->config[ "savePath" ];if ( strrchr( $pathStr , "/" ) != "/" ) { $pathStr .= "/";}$pathStr .= date( "Ymd" );if ( !file_exists( $pathStr ) ) { if ( !mkdir( $pathStr , 0777 , true ) ) { return false; }}return $pathStr;替換為:
$pathStr = $this->config[ "savePath" ];$pathStr = str_replace('//', '/', $pathStr);if ( strrchr( $pathStr , "/" ) == "/" ) { $pathStr = substr($pathStr, 0, -1);}$dirpath = explode('/',$pathStr.date('/Ym'));//通過斜杠分割$dir = '';for($i=0;$iconfig[ "savePath" ]; if ( strrchr( $pathStr , "/" ) != "/" ) { $pathStr .= "/"; } $pathStr .= date( "Ymd" ); if ( !file_exists( $pathStr ) ) { if ( !mkdir( $pathStr , 0777 , true ) ) { return false; } }*/ return $dir;修改/include/ueditor/php/imageUp.php
找到:
"savePath" => "upload/" ,
替換為:
"savePath" => "../../../uploads/allimg/bdimg" ,
找到:
echo "{'url':'" . $info["url"] . "','title':'" . $title . "','original':'" . $info["originalName"] . "','state':'" . $info["state"] . "'}";替換為
echo "{'url':'" . str_replace('../','',$info[ "url" ]) . "','title':'" . $title . "','original':'" . $info["originalName"] . "','state':'" . $info["state"] . "'}";修改說明:第一處替換就是修改圖片保存路徑的,第二處替換是因為這里用的是相對路徑要把../替換掉,返回給編輯器后就是絕對路徑了。如這里上傳了一張圖片1.jpg,他的路徑就是../../../uploads/allimg/bdimg/201220/1.jpg,結合前面修改editor_config.js的,imagePath:"/"總終路徑就是/../../../uploads/allimg/bdimg/201220/1.jpg,所有這里替換一下。以下的幾個文件修改跟這個是類似的。
修改ueditor圖片上傳程序/include/ueditor/php/getRemoteImage.php
找到:
"savePath" => "upload/" ,
替換為:
"savePath" => "../../../uploads/allimg/bdimg" ,
找到:
//創建保存位置$savePath = $config[ 'savePath' ];if ( !file_exists( $savePath ) ){mkdir( "$savePath" , 0777 );}替換為:
//創建保存位置$savePath = $config[ 'savePath' ];$dirpath = explode('/',$savePath.date('/Ym'));//通過斜杠分割$savePath = '';for($i=0;$i{if($i != count($dirpath)){$savePath .= $dirpath[$i].'/';}if(!file_exists($savePath)){if(!mkdir($savePath,0777,true))return false;}}找到:
echo "{'url':'" . implode( "ue_separate_ue" , $tmpNames ) . "','tip':'遠程圖片抓取成功!','srcUrl':'" . $uri . "'}";替換為:
echo "{'url':'" . implode( "ue_separate_ue", str_replace('../', '', $tmpNames)) . "','tip':'遠程圖片抓取成功!','srcUrl':'" . $uri . "'}";一般編輯用的最多就是圖片上傳和遠程抓圖這兩個功能了,其他如:涂鴉、截屏啥的可以自己做下修改就行了,修改方法跟上面的類似;ueditor那個圖片在線管理目前來看沒什么很大的用處。dedecms整合百度編輯器(Ueditor)圖片路徑修改差不多就這樣了,自己看下是不是可以測試使用。
2017年8月10增加部分:
修改ueditor上傳文件的路徑,這個就是最新版的百度編輯器修改的地方,很多朋友一直糾結在這個地方
include/ueditor/php/config.json
里面的
http://www.survivalescaperooms.com/ueditor/php/upload/image/
http://www.survivalescaperooms.com/ueditor/php/upload/video/
http://www.survivalescaperooms.com/ueditor/php/upload/file/
修改成自己的,如:
/uploads/allimg/
/uploads/video/
/uploads/file/
dedecms織夢更換ueditor后欄目內容、單頁無法保存問題的解決方法
打開
/dede/templets/catalog_add.htm (dede是你的后臺目錄)
/dede/templets/catalog_edit.htm
把里面的 form 放置到
<td height="95" align="center" bgcolor="#FFFFFF">
內,就可以了。
如果其他朋友還有什么補充的可以聯系我們,我們會繼續完善。
新聞熱點
疑難解答