下载最新版 ckfinder 本人下载的php版本

https://cksource.com/ckfinder/download

下载最新版ckeditor

http://ckeditor.com/

把它们解压放到指定的目录

html 文件主页内容

需要修改的配置文件

修改ckeditor 的配置文件

Public\Ckeditor\ckeditor\config.js

/**

  • @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  • For licensing, see LICENSE.md or http://ckeditor.com/license

    */

CKEDITOR.editorConfig = function( config ) {

// Define changes to default configuration here. For example:

//设置为中文

config.language = 'zh-cn';

//背景颜色

config.uiColor = '#14B8C4';

// 设置宽高

config.height = 600;

//去掉图片预览英文
config.image_previewText = ' '; config.filebrowserBrowseUrl = '/Public/Ckeditor/ckfinder/ckfinder.html?Type=Files';
config.filebrowserImageBrowseUrl = '/Public/Ckeditor/ckfinder/ckfinder.html?Type=Images';
config.filebrowserFlashBrowseUrl = '/Public/Ckeditor/ckfinder/ckfinder.html?Type=Flash';
config.filebrowserUploadUrl = '/Public/Ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files';
config.filebrowserImageUploadUrl = '/Public/Ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images';
config.filebrowserFlashUploadUrl = '/Public/Ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash';

};

需要其他的自己定义

修改ckfinder 的配置文件

Public\Ckeditor\ckfinder\config.php

ini_set('display_errors', 0); 改为 ini_set('display_errors', 1); 有错误信息方便调试

$config['authentication'] = function () {

return false;

};

改为

session_start();

$config['authentication'] = function () {

if(isset($_SESSION['username'])){

return true;

}else{

return false;

}

};

允许上传 并增加安全验证 可以根据自己的需要修改

$config['backends'][] = array(

'name' => 'default',

'adapter' => 'local',

'baseUrl' => '/ckfinder/userfiles/',

// 'root' => '', // Can be used to explicitly set the CKFinder user files directory.

'chmodFiles' => 0777,

'chmodFolders' => 0755,

'filesystemEncoding' => 'UTF-8',

);

改为

$baseUrl 具体的自己定义

$baseDir

$config['backends'][] = array(

'name' => 'default',

'adapter' => 'local',

'baseUrl' => $baseUrl, //新的上传文件访问路径

'root' => $baseDir, // 新修改的文件上传根目录

'chmodFiles' => 0777,

'chmodFolders' => 0755,

'filesystemEncoding' => 'UTF-8',

);

$config['resourceTypes'][] = array(

'name' => 'Images',

'directory' => 'images',

'maxSize' => 0,

'allowedExtensions' => 'bmp,gif,jpeg,jpg,png',

'deniedExtensions' => '',

'backend' => 'default'

);

改为

$config['resourceTypes'][] = array(

'name' => 'Files', // Single quotes not allowed.

'directory' => 'img/ckeditor/files', //修改上传的具体路径

'maxSize' => 0,

'allowedExtensions' => '7z,aiff,asf,avi,bmp,csv,doc,docx,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pptx,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xlsx,zip',

'deniedExtensions' => '',

'backend' => 'default'

);

其他的像上传flash 都做同样的修改

最后修改上传文件名称,防止中文乱码

\Ckeditor\ckfinder\core\connector\php\vendor\cksource\ckfinder\src\CKSource\CKFinder\Utils.php

public static function replaceDisallowedExtensions($fileName, ResourceType $resourceType)

{

$pieces = explode('.', $fileName);

    $basename = array_shift($pieces);
$lastExtension = array_pop($pieces); foreach ($pieces as $ext) {
$basename .= $resourceType->isAllowedExtension($ext) ? '.' : '_';
$basename .= $ext;
}
/**
* 重新定义命名规则 自己定义
*/
$sFileName=date('YmdHis').mt_rand(1000,9999);
// Add the last extension to the final name.
return $sFileName . '.' . $lastExtension;
}

CKEditor + CKFinder 实现编辑上传图片配置的更多相关文章

  1. CKEditor + CKFinder 实现编辑上传图片配置 (二)

    CKEditor + CKFinder 实现编辑上传图片配置 (二) 上传图片时,如果上传的图片过大,默认情况情况下回自动裁剪,代码如图 \ckfinder\config.php 目录下的配置文件co ...

  2. (配置)CKEditor+CKFinder+php上传配置,根据年月命名创建文件夹来存放

    CKEditor+CKFinder+php上传配置 新版本的CKEditor只提供了基本的文本编辑功能,上传模块由另一个组件CKFinder.这里主要记录CKFinder上传的一些参数配置,能够成功上 ...

  3. CKEditor && CKFinder 配置

    准备                                                                                                   ...

  4. 网络编辑器插件ckeditor+ckfinder配置

    原帖地址 另外一个 去掉编辑器的下边栏 在config.js中加入: config.removePlugins = 'elementspath'; config.resize_enabled = fa ...

  5. jsp中如何整合CKEditor+CKFinder实现文件上传

    最近笔者做了一个新闻发布平台,放弃了之前的FCKEditor编辑器,使用了CKEditor+CKFinder,虽然免费的CKFinder是Demo版本,但是功能完整,而且用户都是比较集中精神发新闻的人 ...

  6. .Net在线编辑器:KindEditor及CkEditor+CkFinder配置说明

    Net在线编辑器:KindEditor及CkEditor+CkFinder配置说明 一.KindEditor(免费) KindEditor是一套开源的HTML可视化编辑器,主要用于让用户在网站上获得所 ...

  7. CKEditor & CKFinder集成

    CKEditor集成 CKEditor(原名FckEditor): 著名的HTML编辑器(可在线编辑HTML) 配置: ①将CKEditor中的(adapters images lang plugin ...

  8. 在ASP.NET项目中使用CKEditor +CKFinder实现图片上传功能

    前言 之前的项目中一直使用的是FCKeditor,昨天突然有个想法:为什么不试一下新的CKEditor呢?于是花了大半天的时间去学习它的用法,现在把我的学习过程与大家分享一下. 谈起FCKeditor ...

  9. drupal中安装CKEditor文本编辑器,并配置图片上传功能 之 方法二

    drupal中安装CKEditor文本编辑器,并配置图片上传功能 之 方法一 中介绍了ckeditor的安装和配置方法,其实还有另一种新方法,不用IMCE模块. 不过需要ckfinder的JS库,可以 ...

随机推荐

  1. ActionBar隐藏修改图标和标题

    有时候在一些子页面或者内容页面,不需要显示ActionBar的标题栏图标.可用如下方式进行设置. 首先获取到ActionBar对象 ActionBar actionBar=getActionBar() ...

  2. CSS权威指南学习笔记 —— HTML元素分类

    HTML文档由各种元素组成.比如,p.table.span等等.每个元素都会对文档的表现有所影响.CSS中,每个元素都会生成一个框(传说中的盒子),其中包含元素内容. 元素可以根据它的创建方式分为两种 ...

  3. linux下的进程、网络、性能监控命令

    进程监控 端口   1)netstat -anp | grep xxx   2)lsof  -i:<port> 句柄    lsof  -n | grep xxxx 线程栈   1)gst ...

  4. sqlserver事务与回滚

    如果要在Production执行数据改动必须小心,可以使用事务提前验证一下自己写的SQL是不是你期望的.尤其是Update的where 条件有问题的话,跟新的记录就会超出预期的范围.如下面的语句,一着 ...

  5. LintCode (9)Fizz Buzz

    下面是AC代码,C++风格: class Solution { public: vector<string> fizzBuzz(int N) { vector<string> ...

  6. HDU 2685 I won't tell you this is about number theory

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2685 题意:求gcd(a^m - 1, a^n - 1) mod k 思路:gcd(a^m - 1, ...

  7. JVM学习之常用概念

    方法区     当JVM使用类装载器装载某个类时,它首先要定位对应的class文件,然后读入这个class文件,最后,JVM提取该文件的内容信息,并将这些信息存储到方法区,最后返回一个class实例. ...

  8. shell基础认识

    Shell 我们在终端下写命令Linux内核是看不懂的必须通过shell解释成内核可执行的代码 这就是shell(其实解释命令这只是它的一个功能模块,shell还可以用来进行程序设计) 有点类似win ...

  9. Android 调用系统通讯录

    这个过程有三步:1)许可向你的应用程序的manifest中添加读取通讯录数据的许可  <uses-permission android:name="android.permission ...

  10. Eclipse --Type /com.xx.app/gen already exists but is not a source folde解决方案

    两种解决方案: Two actions, first: 1.Right click on the project and go to "Properties" 2.Select & ...