Jump to content

CKEditor JS file location?


g1nt3r

Recommended Posts

Posted
40 minutes ago, Nathan Explosion said:

applications\core\interface\ckeditor

That plugin may not be compatible with IPS4.1 (uses ckeditor 4.5)

Thanks bud, I mean it's workin just cant figure out how to set where the images are. Any chance you could walk me through it, I'll love you forever if you do

Posted

Never used it as far I can recall, so if I have time over next few days then I'll try to read through the documentation and view the demo, but you'll probably be quicker doing that yourself.

Adding the items to the ckeditor config is quite easy:

CKEDITOR.config.extraPlugins = 'simple-image-browser';

Not needed - the action of adding the plugin via the ACP does this for you.

CKEDITOR.config.simpleImageBrowserURL = <INSERT URL>;

Edit applications\core\interface\ckeditor\ckeditor\config.js and add that the bottom of the file (be prepared to possibly do this again after IPS4 upgrades)

The '<INSERT URL>' part? On a quick read of the example, do you have a file url that will return all your images in the following format?

// JSON Response Example
[{
    // File 1
    url: <URL TO FILE HERE>
},{
    // File 2
    url: <URL TO FILE HERE>
}]

If so, then the url to that file is what you put in the config.js portion.

Posted

Quick and dirty playing about......

In the directory that has your images, create a php file with the following content:

<?php
$url = "http" . (($_SERVER['SERVER_PORT'] == 443) ? "s://" : "://") . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$scriptname = basename(__FILE__);
foreach (glob("*.{jpg,png,gif}", GLOB_BRACE) as $filename) {
    $stuff[]['url'] = str_replace($scriptname, $filename, $url);
}
echo json_encode($stuff)
?>

Open the www.domain.com/path/to/file.php url and you will then have a json array of all the images (that use jpg,png or gif extensions) in that directory.

Then put the url for that php file in to the config.js entry:

CKEDITOR.config.simpleImageBrowserURL = '//www.domain.com/path/to/file.php';

Should work fine - only issue is that, for some reason, the url of the image (after it has been added to the editor) has a '?csrfKey=' query string added. No idea why - appears to be getting added by the editor/plugin for some reason.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...