定制 qjon/ri-filemanager 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

  1. Add to your composer.json

    ..., "require": { ..., "qjon/ri-filemanager": "dev-master" }

  2. 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.

  1. Add routing

    RIFileManagerBundle: resource: "@RIFileManagerBundle/Resources/config/routing.yml" prefix: /filemanager

  2. 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:

  1. CSS template (include all CSS files)

    {% include 'RIFileManagerBundle:Default:css.html.twig' %}

  2. 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 我们能提供哪些服务?
定制开发 / 二次开发

基于 qjon/ri-filemanager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 58
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-07-29