Integration of Elfinder file manager(2.0-rc1) with tinymce(4.0.10) for Cakephp 2.x. Allows to upload images(and other files) in tinymce. Can be a free alternative for Tinymce MoxieManager image upload plugin
- Tinymce 4.0.1 http://www.tinymce.com/download/download.php (not included in Plugin, should be downloaded and installed separately)
- Elfinder 2.0-rc1 http://elfinder.org/ (already included in plugin)
This Cake plugin was developed by http://hashmode.com Video Demonstration - http://hashmode.com/tinymce-image-upload-cakephp/38
Considers that tinymce is already installed
- Copy TinymceElfinder folder into app/Plugin and Load Plugin adding
CakePlugin::load('TinymceElfinder');
line intobootstrap.php
- Copy
elfinder.php
config file intoapp/Config
folder - Add the helper and component in your controller
public $helpers = array('TinymceElfinder.TinymceElfinder');
public $components = array('TinymceElfinder.TinymceElfinder');
-
In tinymce init add
file_browser_callback:elFinderBrowser
, and before the script tag(or file), where the tinymce init is located, add this<?php $this->TinymceElfinder->defineElfinderBrowser()?>
-
Create 2 functions in your controller,
public function elfinder() {
$this->TinymceElfinder->elfinder();
}
public function connector() {
$this->TinymceElfinder->connector();
}
and replace my_controller with your controller's name in elfinder.php
config file
- Create folder
Uploads
underwebroot/img
(default, can be changed from elfinder.php)
In elfinder.php config file
window_url
and connector_url
- are the urls by which the file manager window and connector are called, should be according to in which controller you create elfinder()
and connector()
functions(these can be changed as well), as described in 5th step.
For cake version 2.4 and above in config file use Router::fullbaseUrl()
, otherwise FULL_BASE_URL
All the rest options are the elfinder plugin options https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options
If you get some error and than fix it be sure to empty the browser's Cache: CTRL + F5 will NOT help, perhaps because of iframes.
Plugin per se is completely free to use in any application(including commercial) or to modify, merge, copy, distribute etc. unless these actions are not restricted by the source plugins' (Tinymce and Elfinder) license terms.