Page 1 of 1

CKEditor imgbrowse - set plugin address

Posted: 10 Nov 2016, 14:31
by justanumber
Great feature! Replaced the version downloaded from CKEditor site with the zip version from this page: ckeditor-delete-option-imgbrowse-t156.htm#p467

No longer loads the images directory I have set on page.
The version from CKEditor works fine with these settings?

In my setup, really like to use the feature like:

Code: Select all

'../ckeditor/plugins/imgbrowse/imgbrowse.html?imgroot=mathtest/images',
Thank you for great plugin,

CKEditor imgbrowse - set plugin address

Posted: 10 Nov 2016, 15:27
by Admin
Hello,
If you want to use the plugin with address set in JS code, with this format:

Code: Select all

'../ckeditor/plugins/imgbrowse/imgbrowse.html?imgroot=dir_in_root/dir_images',
- in the version from the ZIP archive from that page, replace this code in "imgbrowse.php" file:

Code: Select all

function __construct() {
  if(isset($_SESSION['user'])) $this->root = trim($this->root, '/') .'/'. $_SESSION['user'] .'/';
  else $this->root = trim($this->root, '/') .'/';
  $this->imgdr = isset($_POST['imgdr']) ? trim(trim(strip_tags($_POST['imgdr'])), '/') .'/' : '';
}
With this:

Code: Select all

function __construct() {
  if(isset($_SESSION['user'])) $this->root = trim($this->root, '/') .'/'. $_SESSION['user'] .'/';
  else{
    if(isset($_POST['imgroot'])) $this->root = trim(strip_tags($_POST['imgroot']));
    $this->root = trim($this->root, '/') .'/';
  }
  $this->imgdr = isset($_POST['imgdr']) ? trim(trim(strip_tags($_POST['imgdr'])), '/') .'/' : '';
}
- Or download again that zip (it is updated with this modification).

CKEditor imgbrowse - set plugin address

Posted: 10 Nov 2016, 16:21
by justanumber
Thank you! Works great. The delete feature is very useful.

Sorry if my original request was posted in wrong thread/area.

Cheers!