使用ueditor編輯器,附件默認(rèn)在ueditor/php/upload/, 我的附件地址是網(wǎng)站根目錄下/data/upload/ ,需要修改ueditor如下:
第一步:打開(kāi)php/config.php修改圖片目錄
復(fù)制代碼 代碼如下:
return array(
//圖片目錄
'imageSavePath' => array (
'../../../../data/upload'
)
);
第二步:圖片上傳后去掉相對(duì)路徑php/imageUp.php
復(fù)制代碼 代碼如下:
$info["url"]=str_replace('../../../../', '', $info["url"]);
echo "{'url':'" . $info["url"] . "','title':'" . $title . "','original':'" . $info["originalName"] . "','state':'" . $info["state"] . "'}";
exit;
第三步:打開(kāi)ueditor.config.js修改圖片路徑
復(fù)制代碼 代碼如下:
,imagePath:"/"
第四步:如果你想修改圖片生成路徑或圖片名稱(chēng)
修改圖片生成路徑在php/Uploader.class.php
復(fù)制代碼 代碼如下:
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”,然后按照官方文檔說(shuō)明修改!
您可能感興趣的文章:- vue集成百度UEditor富文本編輯器使用教程
- vue項(xiàng)目中應(yīng)用ueditor自定義上傳按鈕功能
- UEditor 自定義圖片視頻尺寸校驗(yàn)功能的實(shí)現(xiàn)代碼