Welcome Guest, Not a member yet? Register   Sign In
CKeditor with upload
#1

Can anyone tell me if this thing is a good or bad idea?? I honestly have no clue and I'm generally terrified of javascript.

https://github.com/moemoe89/codeigniter-...ilemanager
Reply
#2

Good of bad in what context?

Allowing members of the public to upload porn to your website - not a good idea
Allowing logged in and authorized users to upload limited sized images to documents, a good idea.

Letting users upload images or files always should be treated with extreme caution. Personally I try to avoid it but if it really is required try to keep as tight a control on it as you can.

There is nothing that is absolutely good or absolutely bad, and JS is nothing to be scared of, it is just logic performed at the user end, rather than the server end of your site.

Best wishes,

Paul.
Reply
#3

@ChicagoPhil

I think, the concrete implementation is lazy. I see this area in a bit more complicated way:

The online editor has to be configured form the PHP side with special configuration files (.php), it should have different configuration profiles: 'admin', 'user', or whatever else you want.

The configuration profiles should manage the following aspects: the buttons of the editor that are visible and their placement; whether a file manager is enabled or not; the upload directory (or directories?); the allowed file types for uploading; the allowed tags - for this kind of filtration HTMLPurifier can be used.

So, if you have these different profiles, you can allow site managers to embed images and other stuff (yt video, etc.) within the created text. For ordinary users only formatted text could be allowed, without images and other embedded stuff, and at your choice, without links.

At the end, a special helper function is needed for placing easily the editor with desired configuration within a form.

IMO, the link you posted does not merit attention, there is no added value there.
Reply
#4

are you asking about the specific library or about CK editor? Ck editor has been around a long time and there are many websites that use it.
Reply
#5

I use this Responsive File Manager with CKEditor:

Responsive File Manager
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#6

Just the library. I thought someone might have used it. I currently use ckeditor. I want to add upload functionality.

Thank you for the replies and links.
Reply
#7

(05-06-2016, 01:20 PM)InsiteFX Wrote: I use this Responsive File Manager with CKEditor:

Responsive File Manager

Hi InsiteFX, are you willing to share how you implemented this in CodeIgniter? E.g. where to put the filemanager folder, and which settings you've made in the config files?
Reply
#8

(This post was last modified: 05-08-2016, 05:08 AM by InsiteFX.)

This is kind of long, but you will get the idea.

NOTE: If you get a 404 File Not Found then 10 to 1 it is the javascript paths.

Setup for assets

[Image: assets.png]

At the bottom of you view add this code:

Code:
<!-- ckeditor.js, load it only in the page you would like to use CKEditor -->
<script src="<?php echo asset('ckeditor/ckeditor.js');?>"></script>

<!-- This is used in controllers/admin/Dashboard.php
       If used just under controllers then remove the ../
-->
<!-- add responsive filemanager to ckeditor. -->
<script>
    CKEDITOR.replace('textarea-ckeditor',{
        filebrowserBrowseUrl : '../assets/filemanager/dialog.php?type=2&editor=ckeditor&fldr=',
        filebrowserUploadUrl : '../assets/filemanager/dialog.php?type=2&editor=ckeditor&fldr=',
        filebrowserImageBrowseUrl : '../assets/filemanager/dialog.php?type=1&editor=ckeditor&fldr='
    });
</script>

The form take note of the form id and name:

PHP Code:
<!-- Textareas and Editor Content -->
<
form action="page_forms_components.html" method="post" class="form-horizontal" onsubmit="return false;">
 
  
   
<!-- CKEditoryou just need to include the plugin (see at the bottom of this page) and add the class 'ckeditor' to your textarea -->
 
  <!-- More info can be found at http://ckeditor.com -->
 
  <div class="form-group">
 
     <!--<label class="control-label" for="textarea-ckeditor">CKEditor</label>-->
 
     <div class="col-md-12">
 
        <textarea id="textarea-ckeditor" name="textarea-ckeditor" class="ckeditor"></textarea>
 
     </div>
 
  </div>

</
form>
<!-- 
END Textareas and Editor Content --> 

Filemanager assets/filemanager/config/config.php

PHP Code:
/*
    |--------------------------------------------------------------------------
    | path from base_url to base of upload folder
    |--------------------------------------------------------------------------
    |
    | with start and final /
    | I point this to my images folder because thats all that will be uploaded.
                  | You can change this if you want to.
    */
    
'upload_dir' => '/assets/images/',

    
/*
    |--------------------------------------------------------------------------
    | relative path from filemanager folder to upload folder
    |--------------------------------------------------------------------------
    |
    | with final /
    |
    */
    
'current_path' => '../images/',

    
/*
    |--------------------------------------------------------------------------
    | relative path from filemanager folder to thumbs folder
    |--------------------------------------------------------------------------
    |
    | with final /
    | DO NOT put inside upload folder
    |
    */
    
'thumbs_base_path' => '../images/thumbs/'

That will get you up and running using the filemanager with CKEditor.

The rest will be up to you to configure, there is not enough room to add everything here...

asset_helper can be found here: asset_helper
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#9

@InsiteFX: thank you very much! I will give it a try.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB