kindeditor更改圖片上傳時網絡圖片的路徑


當我們想要使用kindeditor的圖片上傳功能時,有兩種選擇圖片方式,一種是本地選擇,一種是在圖片空間中選擇,圖片空間的默認地址是server上的/kindeditor/attached/image/以下。

假設想要改變這個路徑,須要找到/kindeditor/php/file_manager_json.php這個文件,然后能夠看到以下幾行:

//根文件夾路徑,能夠指定絕對路徑,比方 /var/www/attached/
$root_path = $php_path . '../attached/';
//根文件夾URL,能夠指定絕對路徑,比方 http://www.yoursite.com/attached/
$root_url = $php_url . '../attached/';
//圖片擴展名
$ext_arr = array('gif', 'jpg', 'jpeg', 'png', 'bmp');

//文件夾名
$dir_name = empty($_GET['dir']) ? '' : trim($_GET['dir']);
if (!in_array($dir_name, array('', 'image', 'flash', 'media', 'file'))) {
	echo "Invalid Directory name.";
	exit;
}
if ($dir_name !== '') {
	$root_path .= $dir_name . "/";
	$root_url .= $dir_name . "/";
	if (!file_exists($root_path)) {
		mkdir($root_path);
	}
}

期初我更改了$root_path和$root_url的地址發現沒有效果,使用file_put_contents()打印出$dir_name后,發現其值默認是image,也就是說我把路徑改成img后,那么圖片空間的路徑則是img以下的image,因此我刪除了文件夾名以下的幾行,改動成功。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM