UEditor編輯器自定義上傳圖片或文件路徑的修改方法
使用ueditor編輯器,附件默認(rèn)在ueditor/php/upload/, 我的附件地址是網(wǎng)站根目錄下/data/upload/ ,需要修改ueditor如下:
第一步:打開php/config.php修改圖片目錄
return array(
//圖片目錄
'imageSavePath' => array (
'../../../../data/upload'
)
);
第二步:圖片上傳后去掉相對路徑php/imageUp.php
$info["url"]=str_replace('../../../../', '', $info["url"]);
echo "{'url':'" . $info["url"] . "','title':'" . $title . "','original':'" . $info["originalName"] . "','state':'" . $info["state"] . "'}";
exit;
第三步:打開ueditor.config.js修改圖片路徑
,imagePath:"/"
第四步:如果你想修改圖片生成路徑或圖片名稱
修改圖片生成路徑在php/Uploader.class.php
private function getFolder()
{
$pathStr = $this->config[ "savePath" ];
if ( strrchr( $pathStr , "/" ) != "/" ) {
$pathStr .= "/";
}
$pathStr .= date( "Ym/d" );
if ( !file_exists( $pathStr ) ) {
if ( !mkdir( $pathStr , 0777 , true ) ) {
return false;
}
}
return $pathStr;
}
修改文件名,在ueditor.all.min.js中搜索“fileNameFormat”,然后按照官方文檔說明修改!
相關(guān)文章
百度UEditor修改右下角統(tǒng)計字?jǐn)?shù)包含html樣式
百度UEditor修改右下角統(tǒng)計字?jǐn)?shù)默認(rèn)只統(tǒng)計前臺所見的文字個數(shù),如何讓右下角統(tǒng)計字?jǐn)?shù)包含html樣式,需要的朋友可以參考下2014-07-07解決SyntaxHighlighter 代碼高亮不換行問題的解決方法
用SyntaxHighlighter 語法高亮插件的朋友可能都遇到過代碼顯示不換行的問題,這個問題在網(wǎng)上也找不到什么解決辦法,一直困擾了我很久,今天算是把它解決了,辦法其實簡單,下面說下如何解決2014-11-11FCKEditor SyntaxHighlighter整合實現(xiàn)代碼高亮顯示
近日做個小網(wǎng)站,用到了代碼高亮嵌入顯示功能,想將FCKeditor和dp.SyntaxHighlighter結(jié)合使用。2009-06-06FCKeditor提供了一個完整的JavaScript API
FCKeditor提供了一個完整的JavaScript API(Application Public Interface),你可以利用這些API來處理FCK編輯器,只要它被加載完成或在正在運行中.2009-12-12