Images From Server for CKEditor

The plugin has 2 parts:

  1. A javascript code that detects the images added in the content
  2. A program that will run in your server which will import the images from other webs

Next it is explained how to configure these 2 parts.

Javascript configuration in CKEditor

You only require to set up in CKEditor the "imagesfromserver_importer" parameter to indicate the path where the information about the images will be sent. The plugin will return de URL of the imported images.

Program configuration in your server

importer.aspx/importer.php is the script that will run in your server. In this file you will find a complete reference for its implementation. This file has been renamed with an additional ".txt" extension to prevent it from being executed by mistake (or someone else to use it before it's already set up properly).

First, modify this sentence so only users with permission can run the script. If you ignore this step, any person will be able to import any file into you web.

    if (true)
        return sendError("You're not allowed to upload files");

For example:

    if (!User.Authenticated)
        return sendError("You're not allowed to upload files");

Next, indicate in baseUrl the web path where you want to store the images files. It will make sense to use the same one that you are using to store the images uploaded from your computer.

    String baseUrl = @"~/userfiles/";

You can also leave the program to calculate this path automatically:

   String basePath = Request.MapPath(baseUrl);

The rest of the code will ask the external server for the images and will store them in your server. You can modify this code to add your restrictions, modify the way the files are recorded, new functionalities, etc...

If you have any question, please contact us.