Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
g1nt3r Posted February 15, 2016 Posted February 15, 2016 Need to add a line to the file editor js file too add the file location for this plugin (http://ckeditor.com/addon/simple-image-browser). Anyone know where I can find it in my directory?
Nathan Explosion Posted February 15, 2016 Posted February 15, 2016 applications\core\interface\ckeditor That plugin may not be compatible with IPS4.1 (uses ckeditor 4.5)
g1nt3r Posted February 15, 2016 Author Posted February 15, 2016 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
Nathan Explosion Posted February 15, 2016 Posted February 15, 2016 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.
g1nt3r Posted February 16, 2016 Author Posted February 16, 2016 Sweet! Thanks @Nathan Explosion! Good lookin out comrade.
Nathan Explosion Posted February 17, 2016 Posted February 17, 2016 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.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.