Giter VIP home page Giter VIP logo

kcfinder_ckeditor_absolute_url's Introduction

How To Setup KCFinder with absolute URL with CkEditor:

Recently in a project I need to use some Rich Text Formatter (RTF)/WYSIWYG text editor, I decided to select some of available in web.

I wanted to upload images via WYSIWYG text editor, so I used:

A) - CKEditor

B) - KCFinder as alternative of CkFinder

C) - Prevent WYSIWYG upload access, if user not login

I wanted absolute url of upload image or selected image from WYSIWYG text editor e.g. "http://localhost/CkEditor-KcFinder/upload/4856dkfgd674768.jpg"

I also found that many users are confuse to setup KCFinder with CKEditor. They all are searching "How to get absolute url in KCFinder?".

So I just made a demo about KCFinder setup with CKEditor. The code ready to use, what you have to do

  1. download repository/clone
  2. unzip the source code in your wamp/lamp/xamp root folder and access the url to start demo
  3. open http://localhost/CkEditor-KcFinder/

Version Details

A) - CkEditor 4.6.2

B) - KcFinder 3.12

Path Details

A) - Project Path - D:/wamp/www/CkEditor-KcFinder

B) - Upload Path - D:/wamp/www/CkEditor-KcFinder/upload

C) - CkEditor Path - D:/wamp/www/CkEditor-KcFinder/ckeditor

D) - KcFinder Path - D:/wamp/www/CkEditor-KcFinder/kcfinder

Setting Details - settings.php

Make the changes according to your requirement in "D:/wamp/www/CkEditor-KcFinder/settings.php"

File information:

  • KcFinder Core Changes

File: D:\wamp\www\CkEditor-KcFinder\kcfinder\core\bootstrap.php

# To check valid SESSION, I have added below code:
/**
 * Start the PHP SESSION if not started already
 */
if (!session_id()) session_start();
/**
 * First of all Check Valid SESSION to access rest 
 */
if (!isset($_SESSION[$_SESSION['AuthCheckKey']]) || $_SESSION[$_SESSION['AuthCheckKey']] === false) {
    die ('Unauthorized access detected.. Service terminated.');
}
  • KcFinder Config Changes

File: D:\wamp\www\CkEditor-KcFinder\kcfinder\conf\config.php

We don't need to set anything in 'config.php' actually, if we are using, 'KCFINDER' session variable to store the session configuration.

This session variable can be set by integrating application to configure KCFinder before its opening. It should contain an array with dynamic settings. The settings which don't exists in the array will use their values set in conf/config.php file. For example, to enable KCFinder you should execute from your application:

Please see the details: https://kcfinder.sunhater.com/install

$_SESSION['KCFINDER'] = array(
    'disabled' => false
);
'disabled' => '',
'uploadURL' => '',
'uploadDir' => '',
/**
 * KcFinder has a SESSION key name 'KCFINDER'
 * You can use this as setup your dynamic config vales
 * if you set uploadURL and uploadDir via SESSION, KcFinder ignore config.php
 * to get these values and it start using SESSION values
 */
$_SESSION['KCFINDER'] = array(
    'disabled' 	=> false,
    'uploadURL' => 'http://www.site.com/upload',
    'uploadDir' => 'var/htdocs/www/upload'
);

Screenshots:

    • Screen -1
    • Screen -2
    • Screen -3

Thanks to kcfinder and ckeditor to make these AWESOME tools.. :)

End Here

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.