linchpinstudios / yii2-filemanager
Yii2 文件管理器。允许您从任何位置动态管理图片和文件
dev-master
2019-09-18 06:22 UTC
Requires
Requires (Dev)
- phpspec/phpspec: ~2.0
- dev-master
- dev-dependabot/npm_and_yarn/global-modules-path-and-webpack-cli--removed
- dev-dependabot/npm_and_yarn/json5-and-babel-loader-and-css-loader-and-style-loader-and-webpack-and-webpack-cli-2.2.2
- dev-dependabot/npm_and_yarn/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/loader-utils-1.4.2
- dev-dependabot/npm_and_yarn/follow-redirects-1.14.8
- dev-dependabot/npm_and_yarn/ajv-6.12.6
- dev-dependabot/npm_and_yarn/path-parse-1.0.7
- dev-dependabot/npm_and_yarn/postcss-7.0.36
- dev-dependabot/npm_and_yarn/lodash-4.17.21
- dev-dependabot/npm_and_yarn/ssri-6.0.2
- dev-dependabot/npm_and_yarn/y18n-4.0.1
- dev-dependabot/npm_and_yarn/elliptic-6.5.4
- dev-dependabot/npm_and_yarn/axios-0.21.1
- dev-dependabot/npm_and_yarn/acorn-5.7.4
- dev-develop
- dev-feature/fileupload
This package is not auto-updated.
Last update: 2024-09-14 14:50:29 UTC
README
Yii2 文件管理器。允许您从任何位置动态管理图片和文件。还包含 TinyMCE 插件。
安装
安装此扩展的首选方法是通过 composer。
运行以下命令之一:
php composer.phar require --prefer-dist linchpinstudios/yii2-filemanager "*"
或添加
"linchpinstudios/yii2-filemanager": "*"
到您的 composer.json
文件的 require 部分。
3) 运行迁移
``` ./yii migrate/up --migrationPath=@vendor/linchpinstudios/yii2-filemanager/migrations ```配置
将模块添加到主配置中。
<?php
return [
//...
'modules' => [
//...
'filemanager' => [
'class' => 'linchpinstudios\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 linchpinstudios\filemanager\assets\FilemanagerTinyAssets;
在控制器操作中添加 Register。
FilemanagerTinyAssets::register($this->view);
然后向 Tiny MCE 插件中添加 'filemanager' 插件。(例如使用 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"
]
]);?>
注意
小部件和其他项目仍在开发中。