TinyMCE editor with file Upload and ajaxfilemanager plugin
TinyMCE is a common editor used in php applications. It includes all common features of editors like fck editor,ck editor..etc. One thing is missing in TinyMCE is file uploading. This editor requires extra plugin for getting file upload feature. Steps for implementing TinyMce photo upload feature is
1.Free Download TinyMce Editior
2. TInyMce have option to add extra plugins.
Tinymce->plugins
I found ajaxfilemanager is the best plugin for TinyMce file upload.
Free Download ajaxfilemananger
3.Copy ajaxfilemanager code in plugin folder and configure it
Tinymce->plugins->ajaxfilemanager->inc->config.bas.php
/*code for setting basepath in tinymce ajaxfilemanger plugin*/
<?php
$filename = (‘../../../../../public/tinymceimages/’);
$dirname=’tinymceimages’;
if (!file_exists($filename)) {
mkdir(“../../../../../public/” . “$dirname”, 0777);
}
define(‘CONFIG_SYS_DEFAULT_PATH’, ‘../../../../../public/tinymceimages/’); //accept relative path only
define(‘CONFIG_SYS_ROOT_PATH’, ‘../../../../../public/tinymceimages/’); //accept relative path only
define(‘CONFIG_SYS_FOLDER_SHOWN_ON_TOP’, true); //show your folders on the top of list if true or order by name
define(“CONFIG_SYS_DIR_SESSION_PATH”, ‘../../../../../temporary/session/’);
?>
Then add the following code in page where tinymce use
<script type=”text/javascript”>
jQuery(‘textarea.tinymce’).tinymce({
// Location of TinyMCE script
script_url : ‘<?php echo $this->baseUrl(); ?>/js/libs/tiny_mce/tiny_mce.js’,
// General options
theme : “advanced”,
file_browser_callback : “ajaxfilemanager”,
plugins : “autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist”,
// Theme options
theme_advanced_buttons1 : “image,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect,ibrowser”,
// theme_advanced_buttons2 : “image,insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak”,
/*theme_advanced_buttons2 : “cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor”,
theme_advanced_buttons3 : “tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen”,
theme_advanced_buttons4 : “insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak”,
*/
theme_advanced_toolbar_location : “top”,
theme_advanced_toolbar_align : “left”,
theme_advanced_statusbar_location : “bottom”,
theme_advanced_resizing : true,
relative_urls:false,
remove_script_host : true,
document_base_url : “/”,
convert_urls : false,
});
</script>