Skip to content

subdesign/codeigniter-elfinder-ckeditor

Repository files navigation

CodeIgniter 3 + elFinder 2 + CKEditor 4

WORKING EXAMPLE

Story

I have some old website with Codeigniter made back in 2010, and updated the core code from CI 2 to CI 3 for client request. Previous file manager was KCFinder, but now I wanted something fresh and modern. Truth to be told, I was struggling setting up this combo in Codeigniter, even there are some tutorials and blog posts for that. And separately there are CKEditor integrations, but not under Codeigniter 3.

So after I successfully made these three working together, I created this tutorial repo maybe someone need the same to solve.

Screenshot 2021-03-23 at 14 38 05

How-to

  1. clone the repo
  2. install composer dependencies
cd yourprojectname
composer install
  1. set your project url in config.php, I'm using Laravel Valet, so mine was:
$config['base_url'] = 'http://codeigniter-elfinder-ckeditor.test';

and composer's autoload.php path

$config['composer_autoload'] = APPPATH.'/../vendor/autoload.php';
  1. enter the url in your browser

Customizations

application\controller\Elfinder_lib.php

  • create your upload folder, and a .tmb folder in it
  • set this path in the options array like
$opts = array(
                'debug' => true,
                'roots' => array(
                    array( 
                        'driver'        => 'LocalFileSystem',
                        'path'          => FCPATH . '/assets/uploads',
                        'URL'           => base_url('assets/uploads'),
                        'tmbURL'        => base_url('assets/uploads/.tmb'),
                        'tmbPath'       => FCPATH .'/assets/uploads/.tmb',
                        ...
  • use your own auth check in the elfinderAccess method (pseudo example)
if ( ! $this->auth->is_logged_in()) {
    return false;
}

application\views\elfinder.php

  • update you css and js paths
  • set you language

application\views\welcome_message.php or your view where CKEditor instance is

  • set CKEditor path and settings

Versions

Codeigniter 3.1.11
elFinder 2.1.57
CKEditor 4.16

Thanks

Thanks for the tutorials in the elFinder github repo, for the basics, and for barryvdh/laravel-elfinder for the idea of creating my own elfinder.php for Codeigniter.

Extra

If you interested in using Laravel Valet with Codeigniter, use this driver and enjoy the benefit of Valet. https://github.com/veekthoven/codeigniter-valet-driver

Contact

Follow me on twitter: @devartpro

About

Integrate Codeigniter 3 , elFinder 2 and CKEditor 4

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published