3

I have researched this and I have found many ways of integrating CKEditor but I'm having trouble integrating CKFinder. My website was created by someone else but I feel I can integrate this myself.

The website contains articles and I have a 'view' that uses CKEditor. It works great but I cannot upload images to the server or browse the server images to insert photos within CKEditor. So I can't add photos within the article text. I'm hoping CKFinder will solve that issue.

I have uploaded the CKFinder files and put them in the same location as the CKEditor. In my addcontent.php I have the CKEditor code declared in the header.

    <script src="<?php echo base_url(); ?>plugins/ckeditor/ckeditor.js"></script>

This is the ckeditor textarea:

    <div class="form-group">
                  <label>Content Text</label>
                  <textarea class="form-control" id="description" name="text" rows="3"></textarea><div id="des_error" class="text-danger"></div>
                </div>

And this is the ckeditor function:

        <script type="text/javascript">
  $(function () {
    // Replace the <textarea id="editor1"> with a CKEditor
    // instance, using default configuration.
    CKEDITOR.replace('description');
    //bootstrap WYSIHTML5 - text editor
    $(".textarea").wysihtml5();

If I declare the ckfinder in the header like this:

    <script src="<?php echo site_url(); ?>plugins/ckfinder/ckfinder.js"></script>

How do I amend the code to allow the CKFfinder to work with the CKEditor so I can browse and upload files within the article text?

As a side note I do not see the CKEditor defined in any of the controllers.

halfer
  • 19,824
  • 17
  • 99
  • 186
LikeToCode
  • 31
  • 1
  • 3

1 Answers1

1

You can use responsivefilemanager : https://www.responsivefilemanager.com/#download-section

<script>

    CKEDITOR.replace('description', {

        filebrowserBrowseUrl: '<?php echo base_url();?>filemanager/dialog.php?type=2&editor=ckeditor&fldr=',

        filebrowserUploadUrl: '<?php echo base_url();?>filemanager/dialog.php?type=2&editor=ckeditor&fldr=',

        filebrowserImageBrowseUrl: '<?php echo base_url();?>filemanager/dialog.php?type=1&editor=ckeditor&fldr='

    });

</script>

You should change configration file at filemanager\config\config.php

upload_dir' => '/uploadfilemanager/source/', //Upload folder

'thumbs_base_path' => '../thumbs/', //Thumbnail folder 

'current_path' => '../source/', // The current path that you're using CKEditor

CKEditor and File Manager

omerimzali
  • 41
  • 2