simialbi / yii2-elfinder
yii2 框架的 Elfinder 实现
1.8.1
2021-08-02 07:01 UTC
Requires
- php: >=5.6
- ext-curl: *
- ext-gd: *
- rmrevin/yii2-fontawesome: ~3.0
- simialbi/yii2-simialbi-base: >=0.10.2 <1.0 | ^1.0.0
- studio-42/elfinder: ~2.1
- yiisoft/yii2: ~2.0
- yiisoft/yii2-bootstrap: ~2.0
- yiisoft/yii2-jui: ~2.0
Requires (Dev)
- phpunit/phpunit: ^7.5.20
- yiisoft/yii2-coding-standards: ~2.0
Suggests
- ext-exif: To use image rotate behavior
- ext-fileinfo: To use mime content type detection in behaviors
- simialbi/yii2-widget-crop: Add an image cropper widget to ElFinderInput
- dev-master
- 1.8.1
- 1.8.0
- 1.7.0
- 1.6.5
- 1.6.4
- 1.6.3
- 1.6.2
- 1.6.1
- 1.6.0
- 1.6.0-alpha.2
- 1.6.0-alpha.1
- 1.5.1
- 1.5.0
- 1.4.7
- 1.4.6
- 1.4.5
- 1.4.4
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2
- 1.1.16
- 1.1.15
- 1.1.14
- 1.1.13
- 1.1.12
- 1.1.11
- 1.1.10
- 1.1.9
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1
- 1.0.1
- 1.0
This package is auto-updated.
Last update: 2024-09-22 14:09:44 UTC
README
本扩展将 jQuery elFinder 集成到 yii2 框架中(yii2 的方式:使用 elFinder 组件、行为、可配置对象、事件等)。此外,它阻止 jui/elfinder css 加载,并为 elfinder 提供自己的样式(基于 bootstrap3 / fontawesome scss 的样式)。
资源
安装
安装此扩展的首选方式是通过 composer。
运行
$ php composer.phar require --prefer-dist simialbi/yii2-elfinder
或添加
"simialbi/yii2-elfinder": "*"
到你的 composer.json
文件的 require
部分
使用方法
设置模块
将模块 elfinder
添加到你的配置文件的模块部分
'modules' => [ 'elfinder' => [ 'class' => 'simialbi\yii2\elfinder\Module', 'options' => [ 'default' => [ 'class' => 'simialbi\yii2\elfinder\ElFinderOptions', 'locale' => 'de_DE.UTF-8', 'maxTargets' => 0 ] ], 'connectionSets' => [ 'default' => [ // like elfinder roots [ 'class' => 'simialbi\yii2\elfinder\ElFinderConfigurationLocalFileSystem', 'path' => '@webroot/files', 'URL' => '@web/files' ] ] ], 'volumeBehaviors' => [ 'default' => [ // like elfinder plugins, add behaviors 'as resizer' => [ 'class' => 'simialbi\yii2\elfinder\behaviors\ImageResizeBehavior', 'maxWidth' => 1920, 'maxHeight' => 1080, 'quality' => 70 ], 'as optimizer' => [ 'class' => 'simialbi\yii2\elfinder\behaviors\ImageOptimizeBehavior' ] ] ] ] ]
示例用法
Elfinder 小部件
要在你的页面中包含一个 elfinder 实例,可以这样调用 elfinder 小部件
<?php /* @var $this yii\web\View */ use simialbi\yii2\elfinder\widgets\ElFinder; $this->title = 'elFinder'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="my-elfinder"> <?php // @see https://github.com/Studio-42/elFinder/wiki/Client-configuration-options-2.1 echo ElFinder::widget([ 'instanceName' => 'default' // from module connectionSets/volumeBehaviors configuration (array key) ]); ?> </div>
可以使用来自 elfinder 客户端配置选项 和 instanceName
来配置小部件。
ElFinderInput 小部件
要包含一个 elfinder 输入字段小部件,可以这样调用输入小部件
<?php /* @var $this yii\web\View */ use simialbi\yii2\elfinder\widgets\ElFinderInput; $this->title = 'elFinder'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="my-elfinder"> <?php // @see https://github.com/Studio-42/elFinder/wiki/Client-configuration-options-2.1 echo ElFinderInput::widget([ 'name' => 'my-file', 'value' => '/path/to/my/file.ext', 'instanceName' => 'default' ]); // or model like usage /* @var $form \yii\widgets\ActiveForm */ /* @var $model \yii\base\Model */ echo $form->field($model, 'my-file')->widget( ElFinderInput::className(), [ 'instanceName' => 'default' ] ); ?> </div>
许可证
yii2-elfinder 采用 MIT 许可证发布。有关详细信息,请参阅捆绑的 LICENSE。