婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 網站建設 > 建站知識 > dedecms整合百度編輯器(Ueditor)二(圖片上傳路徑問

dedecms整合百度編輯器(Ueditor)二(圖片上傳路徑問

POST TIME:2017-11-13 00:46

上一篇回顧

經過努力和摸索上次終于完成了dedecms和百度編輯器(Ueditor)的整合,只是功能不是那么完美。這次主要寫的就是dedecms和ueditor整合優化之圖片上傳路徑問題

dedecms整合ueditor后圖片上傳路徑問題

如果按前篇dedecms整合百度編輯器(Ueditor)一(基本整合)整合后也是可以使用圖片上傳,ueditor在線抓圖的,只是圖片會保存到"\include\Ueditor\php\upload"這個目錄下,為了統一想把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)){
returnfalse;
}
}
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;$i<count($dirpath);$i++)
{
if($i!=count($dirpath))
{
$dir.=$dirpath[$i].'/';
}
if(!file_exists($dir))
{
if(!mkdir($dir,0777,true))returnfalse;
}
}
if(strrchr($dir,"/")=="/"){
$dir=substr($dir,0,-1);
}

/*$pathStr=$this->config["savePath"];
if(strrchr($pathStr,"/")!="/"){
$pathStr.="/";
}
$pathStr.=date("Ymd");
if(!file_exists($pathStr)){
if(!mkdir($pathStr,0777,true)){
returnfalse;
}
}*/
return$dir;



  1. 修改/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,所有這里替換一下。以下的幾個文件修改跟這個是類似的。

  2. 修改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)

    下一篇預告:dedecms整合百度編輯器(Ueditor)三(織夢使用Ueditor圖片水印問題)

    如有問題可以聯系QQ:2655101040,一家一起討論



本文來源:genban.org



收縮
  • 微信客服
  • 微信二維碼
  • 電話咨詢

  • 400-1100-266
主站蜘蛛池模板: 夏邑县| 永年县| 海淀区| 蒙阴县| 松阳县| 封开县| 务川| 霍州市| 临沭县| 晋州市| 西盟| 延寿县| 通辽市| 十堰市| 古丈县| 焉耆| 海晏县| 峨边| 弥渡县| 富川| 苗栗县| 会泽县| 加查县| 黄石市| 晋中市| 梓潼县| 措美县| 浦城县| 绥棱县| 汉源县| 永春县| 共和县| 昭平县| 安龙县| 南部县| 乡城县| 淮阳县| 江阴市| 永定县| 永新县| 梨树县|