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.
After trying a image upload it's giving a code like
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.