tinymce+ibrowser使用笔记
今天处于项目需要,用tinymce做编辑器,花了点时间熟悉了tinymce,起初大概配置了一下。能用,但是用到图片上传的时候,出了点问题。原来tinymce本身不支持图片上传,但是有一个官方插件支持,但需要花钱。于是只能另找出路,google了半天,找到了ibrowser这个插件,配置看了下,挺好用的,就决定用这个插件。废话不多说,配置如下:
tinyMCE.init({
mode : "textareas",
theme : "advanced",
language: "zh",
skin: "o2k7",
plugins: "ibrowser,safari,pagebreak,style,table,advhr,advimage,advlink,emotions,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect,|,blockquote,forecolor,backcolor,|,styleprops",
theme_advanced_buttons2 : "tablecontrols,|,hr,|,replace,removeformat,visualaid,pagebreak,|,charmap,emotions,media,advhr,searchreplace,|,insertdate,inserttime,preview,||,preview,fullscreen,|,print",
theme_advanced_buttons3_add : "ibrowser",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true
});
具体每一个tinymce的配置命令意思,可以上网去查。
下面讲ibrowser的配置,由于我下的是ibrowser1.4.1的,所以有一些配置可以省去,如果有人下的是1.2或者其他版本,可能还要做一下其他配置(复制ibrowser/interface/tinyMCE.editor_plugin.js文件到plugins\ibrowser目录中,并改名为editor_plugin.js)
2>修改ibrowser/config.inc.php,找到$cfg['ilibs'] = array ( // image library path with slashes; absolute to root directory - please make sure that the directories have write permissions
array (
'value' => '/images/upload/',//根据你自己上传图片的目录配置
'text' => 'Site Pictures',
),
array (
'value' => '/images/upload/',
'text' => 'Gallery',
),
);
最后,如果在unix/linux上不要忘记将这些目录, ibrowser/scripts/phpThumb/cache目录, ibrowser/temp目录设为可读写的.
如果在上传图片的时候遇到"ibrowser error building image list",是因为上面设置的图片目录不正确