网上的资料很多 自己记录下 以供使用
1.上传kiededotor 到 include 目录下
2.修改 /admin/includes/lib_main.php 的 create_html_editor 函数
function create_html_editor($input_name, $input_value = '') { global $smarty; /* $editor = new FCKeditor($input_name); $editor->BasePath = '../includes/fckeditor/'; $editor->ToolbarSet = 'Normal'; $editor->Width = '100%'; $editor->Height = '320'; $editor->Value = $input_value; $FCKeditor = $editor->CreateHtml();*/ $kindeditor = <<<EOT <script charset='utf-8' src='/includes/kindeditor/kindeditor-min.js'></script> <script> var editor; KindEditor.ready(function(K) { editor = K.create('textarea[name="$input_name"]', { allowFileManager : true, width : '100%', height: '300px', resizeType: 0 //固定宽高 }); }); </script> <textarea id="$input_name" name="$input_name" style='700px;height:300px;'>$input_value</textarea> EOT; $smarty->assign('FCKeditor', $kindeditor); }
3.修改 \includes\kindeditor\php\ file_manager_json.php 和upload_json.php 文件 保证图片 浏览上传等功能
file_manager_json.php 头部文件
require_once 'JSON.php'; $php_path = dirname(__FILE__) . '/'; $php_url = dirname($_SERVER['PHP_SELF']) . '/'; //根目录路径,可以指定绝对路径,比如 /var/www/attached/ $root_path = $php_path . 'http://www.cnblogs.com/../images/upload/'; //根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/ $root_url = $php_url . 'http://www.cnblogs.com/../images/upload/'; //图片扩展名 $ext_arr = array('gif', 'jpg', 'jpeg', 'png', 'bmp');
upload_json.php
define('IN_ECS', true); require_once 'JSON.php'; require_once 'http://www.cnblogs.com/init.php'; $php_path = dirname(__FILE__) . '/'; $php_url = dirname($_SERVER['PHP_SELF']) . '/';
$file_url = $save_url . $new_file_name; 下面添加
//判断并给符合条件图片加上水印 if ($file_ext == 'jpg' || $file_ext == 'jpeg' || $file_ext == 'png' || $file_ext == 'gif' || $file_ext == 'bmp' ) { require_once(ROOT_PATH . '/includes/cls_image.php'); $image = new cls_image($GLOBALS['_CFG']['bgcolor']); if (intval($GLOBALS['_CFG']['watermark_place']) > 0 && !empty($GLOBALS['_CFG']['watermark'])) { $image->add_watermark($file_path,'','http://www.cnblogs.com/'.$GLOBALS['_CFG']['watermark'], $GLOBALS['_CFG']['watermark_place'], $GLOBALS['_CFG']['watermark_alpha']); } }