2

I am trying to add image upload option in tinymce editor using this plugin.

I have downloaded tinymce and keep it in webroot/js/tinymce folder. Then I downloaded justboil plugin, and keep it in tinymce/plugin folder. Then I have tried this code in my add.ctp file

<?php echo $this->Form->input('details',['class'=>'tinymce']);  ?>

I have used this js code below

    <script>
        tinymce.init({selector:'.tinymce',
           plugins: "jbimages,code"
        });
   </script>

Not it's looking like below image and working fine and also saving code data in database table. enter image description here

After trying a image upload it's giving a code like

enter image description here

In tinymce\plugins\jbimages\config.php file , I have given bellow setting

$config['img_path'] = '/tinymce/images';
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . $config['img_path'];

// same code working fine in php, but not in cakephp. May anyone help me please ?

I have been solve this problem, but still not 100 % accuracy. I am shearing my ans and also need a help to define path.

After add relative_urls: false in tinymce.init

tinymce.init({selector:'.tinymce',
           plugins: "jbimages,code",
           relative_urls: false
});  

and I have also changed upload directory in config.php

$config['img_path'] = '/photobag.in/photobag/img'; 

All is working fine. Here in config.php file how can I dynamically define base_url? For example here photobag.in is my project folder.It may I will change it.

Alimon Karim
  • 4,354
  • 10
  • 43
  • 68
  • possible duplicate of [TinyMCE 4 with elFinder](http://stackoverflow.com/questions/16016870/tinymce-4-with-elfinder) – Fury Aug 17 '15 at 11:53
  • follow this article http://stackoverflow.com/questions/16016870/tinymce-4-with-elfinder – Fury Aug 17 '15 at 11:54

0 Answers0