ckfinder 配置 php,GitHub - itxq/ckfinder: CkFinder3.5.1 for PHP 优化版 (添加又拍云存储)...

CkFinder3.5.1 for PHP 优化版 (添加又拍云存储)

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344372e312d3838393242462e737667

68747470733a2f2f706f7365722e707567782e6f72672f697478712f636b66696e6465722f76657273696f6e

68747470733a2f2f706f7365722e707567782e6f72672f697478712f636b66696e6465722f646f776e6c6f616473

68747470733a2f2f706f7365722e707567782e6f72672f697478712f636b66696e6465722f762f756e737461626c65

68747470733a2f2f706f7365722e707567782e6f72672f697478712f636b66696e6465722f6c6963656e7365

68747470733a2f2f706f7365722e707567782e6f72672f697478712f636b66696e6465722f636f6d706f7365726c6f636b

开源地址:

扩展安装:

方法一:composer命令 composer require itxq/ckfinder

方法二:直接下载压缩包,然后进入项目中执行 composer命令 composer update 来生成自动加载文件

引用扩展:

当你的项目不支持composer自动加载时,可以使用以下方式来引用该扩展包

// 引入扩展(具体路径请根据你的目录结构自行修改)

require_once __DIR__ . '/vendor/autoload.php';

使用示例:

use itxq\ckfinder\CkFinder;

require __DIR__ . '/vendor/autoload.php';

if (isset($_GET['command'])) {

try {

CkFinder::make()

// 配置缓存目录

->setConfig('runtime_path', __DIR__ . '/runtime')

// 授权信息

->setConfig('licenseName', 'licenseName')

->setConfig('licenseKey', 'licenseKey')

// 是否自动重命名(用于过滤用户提交包含中文以及特殊字符,中文会自动转为拼音)

->setConfig('auto_rename', ['folder' => true, 'file' => true])

// 设置PrivateDirKey (可用于区分不同用户的缓存目录,建议使用用户ID)

->setPrivateDirKey('')

// 添加一个又拍云存储空间(添加多个存储空间时,name不可重复)

->addBackend('my_upy', CkFinder::ADAPTER_UPY, [

// 又拍云操作员相关设置

'service' => 'service',

'operator' => 'operator',

'password' => 'password',

// 以下根路径和URL前缀需根据自己项目进行调整

'root' => 'my_upy/',

'baseUrl' => 'http://test.upy.com/my_upy'

])

// 为又拍云存储空间添加一个资源目录(可添加多个)

->addResource('云端存储', '01', 'my_upy')

// 添加一个本地存储空间(添加多个存储空间时,name不可重复)

->addBackend('my_local', CkFinder::ADAPTER_LOCAL, [

// 以下根路径和URL前缀需根据自己项目进行调整

'root' => __DIR__ . '/uploads/my_local',

'baseUrl' => '/uploads/my_local'

])

// 为本地存储空间添加一个资源目录(可添加多个)

->addResource('本地存储', '01', 'my_local')

->run();

} catch (Exception$exception) {

var_dump($exception->getMessage());

}

exit();

}

?>

Document

选择

function selectFileWithCKFinder(elementId) {

CKFinder.modal({

displayFoldersPanel: false,

// readOnly: true,

skin: 'neko',

// skin: 'jquery-mobile',

swatch: 'b',

connectorPath: 'index.php',

chooseFiles: true,

width: 800,

height: 600,

lugins: [],

onInit: function (finder) {

finder.on('files:choose', function (evt) {

var file = evt.data.files.first();

var output = document.getElementById(elementId);

output.value = file.getUrl();

});

finder.on('file:choose:resizedImage', function (evt) {

var output = document.getElementById(elementId);

output.value = evt.data.resizedUrl;

});

}

});

}

修改文件:

core/cksource/ckfinder/src/CKSource/CKFinder/Command/CreateFolder.php

core/cksource/ckfinder/src/CKSource/CKFinder/Command/RenameFolder.php

core/cksource/ckfinder/src/CKSource/CKFinder/Command/RenameFile.php

core/cksource/ckfinder/src/CKSource/CKFinder/Command/FileUpload.php

core/cksource/ckfinder/src/CKSource/CKFinder/Filesystem/File/File.php

core/cksource/ckfinder/src/CKSource/CKFinder/Filesystem/File/UploadedFile.php

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值