drexlerux / yii2-filemanager
Yii2 的文件管理器。允许您从任何位置动态管理图片和文件
v1.0.0
2017-09-23 00:44 UTC
Requires
Requires (Dev)
- phpspec/phpspec: ~2.0
This package is not auto-updated.
Last update: 2024-09-29 02:13:36 UTC
README
Yii2 的文件管理器。允许您从任何位置动态管理图片和文件。还包括 TinyMCE 插件。
安装
安装此扩展的首选方式是通过 composer。
运行以下命令之一:
php composer.phar require --prefer-dist drexlerux/yii2-filemanager "*"
或者
"drexlerux/yii2-filemanager": "*"
将以下内容添加到您的 composer.json
文件的 require 部分。
3) 运行迁移
``` ./yii migrate/up --migrationPath=@vendor/drexlerux/yii2-filemanager/migrations ```配置
将模块添加到主配置中。
<?php
return [
//...
'modules' => [
//...
'filemanager' => [
'class' => 'drexlerux\filemanager\Module',
'thumbnails' => [[100,100]], // Optional: array
'path' => '/images/uploads/', // Default relative to your web directory or AWS
'thumbPath' => '/images/uploads/thumb/', // Default relative to your web directory or AWS
'url' => '/', // either s3 buket URL or CloudFront (can be changed)
'aws' => [
'enable' => true,
'key' => 'YOURAWS_KEY',
'secret' => 'YOURAWS_SECRET',
'bucket' => 'your-bucket',
],
],
//...
],
?>
使用方法
扩展安装完成后,您可以通过访问 http://yourdomain.com/index.php?r=filemanager 来访问模块
Tiny MCE
要使用文件管理器与 Tiny MCE,您需要使用 Yii 注册脚本。
将 "Use" 添加到控制器头部。
use drexlerux\filemanager\assets\FilemanagerTinyAssets;
将 "Register" 添加到控制器动作中。
FilemanagerTinyAssets::register($this->view);
然后,将 'filemanager' 插件添加到 Tiny MCE 插件中。(例如使用 2amigos Tiny MCE 包 在此处找到)
<?= $form->field($model, 'text')->widget(TinyMce::className(), [
'options' => ['rows' => 6],
'language' => 'en',
'clientOptions' => [
'plugins' => [
"advlist autolink lists link charmap print preview anchor",
"searchreplace visualblocks code fullscreen",
"insertdatetime media table contextmenu paste filemanager"
],
'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | filemanager"
]
]);?>
注意
小部件和其他项目仍在开发中。