qjon/ri-filemanager
Composer 安装命令:
composer require qjon/ri-filemanager
包简介
File manager bundle
关键字:
README 文档
README
Symfony2 filemanager bundle
Requirements
JavaScript
- lodash
- jquery
- bootstrap
- angular
- angular-route
- angular-animate
- angular-resource
- angular-strap
- angular-translate
- angular-translate-loader-static-files
- angular-growl-2
- ng-flow
- cropper
PHP
- stfalcon/tinymce-bundle
- friendsofsymfony/jsrouting-bundle
Demo
Here you can find DEMO.
Instalation
This tool is ready to use, you dont need to do anything
-
Add to your composer.json
..., "require": { ..., "qjon/ri-filemanager": "dev-master" }
-
Add to AppKernel.php
public function registerBundles() { $bundles = array( ... new FOS\JsRoutingBundle\FOSJsRoutingBundle(), new RI\FileManagerBundle\RIFileManagerBundle(), );
...}
The first bundle is used to use Symfony routing in JS, the second is our filemanager bundle.
-
Add routing
RIFileManagerBundle: resource: "@RIFileManagerBundle/Resources/config/routing.yml" prefix: /filemanager
-
Set proper configuration in app/config.yml
assetic: ... bundles: ["RIFileManagerBundle"]
...
ri_file_manager: upload_dir: /uploads resize: true resize_max_width: 1600 allow_change_language: true default_language: pl_PL mime_types: images: ['image/jpg', 'image/jpeg', 'image/png', 'image/gif', 'image/png'] audio: ['audio/mpeg', 'audio/x-ms-wma', 'audio/vnd.rn-realaudio', 'audio/x-wav'] video: ['video/mpeg', 'video/mp4', 'video/quicktime', 'video/x-ms-wmv'] archive: ['application/zip'] others: - 'application/pdf' dimensions: - name: Crop size one width: 800 height: 500 - name: Crop size two width: 1200 height: 400
- upload_dir (string) - name of dir in web directory when will be upload all files
- resize (bool) - all uploaded image will be resized if they are too large
- resize_max_width (int) - works only with resize = true
- allow_change_language (bool) - if true display dropdown to change language, if false the dropdown is not shown: default true
- default_language (string) - default language of the app (now available: en_EN, pl_PL), default: en_EN
- mime_types (array) - list of all file types which can be uploaded (if nothing set all file types are available)
- image (array) - list of mime file types which should be interpreted as image type
- audio (array) - list of mime file types which should be interpreted as audio type
- video (array) - list of mime file types which should be interpreted as video type
- archive (array) - list of mime file types which should be interpreted as archive type
- others (array) - list of mime file types which should be available for upload and does not match to any above categories
- dimensions (array) - predefined list of available crop dimensions
Usage
Standalone version
This is the simple way to use this bundle. In your twig template you should include:
-
CSS template (include all CSS files)
{% include 'RIFileManagerBundle:Default:css.html.twig' %}
-
JS template (include third part libraries, application and templates)
{% include 'RIFileManagerBundle:Default:javascript_min.html.twig' %}
Then you should initialize application where you can set some configuration
<script>
var fm = angular.module('fm', ['filemanager'])
.config(['configProviderProvider', function (ConfigProvider) {
ConfigProvider.setConfig({{ filemanager_configuration|json_encode|raw }})
}]);
</script>
<div class="filemanager" ng-app="fm">
<h1>{% verbatim %}{{'FILEMANAGER' | translate}}{% endverbatim %}</h1>
<div class="animation" ng-view style="width: 100%;"></div>
</div>
All above configuration you find in Resources/views/Default/index.html.twig
TinyMce file and image plugin
This bundle can be used as TinyMce file and image plugin. First you should prepare page with TinyMce editor. You can use stfalcon/tinymce-bundle (read installation manual on https://github.com/stfalcon/TinymceBundle).
If you have working example of TinyMce editor, you can attach filemanager plugin.
stfalcon_tinymce:
...
theme:
advanced:
...
file_browser_callback: 'myFileBrowser'
...
Then you should include tinymce JS plugin file and routing files, which open select image dialog.
<script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
<script src="{{ path('fos_js_routing_js', {'callback': 'fos.Router.setData'}) }}"></script>
<script src="{{ asset('bundles/rifilemanager/js/tinymce_plugin.js') }}"></script>
or simple one line
{% include 'RIFileManagerBundle:Default:javascript_tinymce.html.twig' %}
After that you should change filemanager application configuration and set non stand alone version.
<script>
var fm = angular.module('fm', ['filemanager'])
.config(['configProviderProvider', function (configProviderProvider) {
configProviderProvider.setConfig({
standAlone: false
})
}]);
</script>
That is all, everything should work.
qjon/ri-filemanager 适用场景与选型建议
qjon/ri-filemanager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 58 次下载、GitHub Stars 达 2, 最近一次更新时间为 2015 年 07 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「filemanager tinymce」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 qjon/ri-filemanager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 qjon/ri-filemanager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 qjon/ri-filemanager 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox
Adds links to data objects in TinyMCE editor
Simple, fast, standalone PHP lib, that helps You to define, if any of your files were modified since last time You check - Is this file FRESH?
TinyMCE Silverstripe 4 inspired theme
Effortless file management with Symfony UX and Mezcalito UX FileManager
File Manager for Yii2
统计信息
- 总下载量: 58
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-07-29