elFinder

1.3 version
Maintained Unmaintained

elFinder

Note

To focus our efforts onto a manageable number of packages, this package is currently not maintained. Security fixes and submitted bug fixes will still be released, but no new features should be expected. This bundle might have outdated documentation, there is no support from the CMF team and you should not expect bugs to be fixed.

If you want to help co-maintaining this package, tell us in a GitHub issue or in #symfony_cmf of the Symfony devs slack.

The media browser elFinder is integrated with Symfony using the FMElfinderBundle. The MediaBundle provides an adapter to use it with objects implementing the MediaBundle interfaces.

Note

The MediaBundle elFinder adapter is currently only implemented for Doctrine PHPCR-ODM.

Installation

  1. Install the FMElfinderBundle according to the FMElfinderBundle documentation.

  2. Configure the FMElfinderBundle to use the MediaBundle adapter:

    • YAML
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      # app/config/config.yml
      fm_elfinder:
          instances:
              default:
                  locale: "%locale%"
                  editor: ckeditor
                  connector:
                      roots:
                          media:
                              driver: cmf_media.adapter.elfinder.phpcr_driver
                              path: "%cmf_media.persistence.phpcr.media_basepath%"
                              upload_allow: ['all']
                              upload_max_size: 2M
      
    • XML
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      <!-- app/config/config.xml -->
      <?xml version="1.0" charset="UTF-8" ?>
      <container xmlns="http://symfony.com/schema/dic/services">
      
          <config xmlns="http://example.org/dic/schema/fm_elfinder">
              <instances
                  locale="%locale%"
                  editor="ckeditor"
              >
                  <default>
                      <connector>
                          <root
                              name="media"
                              driver="cmf_media.adapter.elfinder.phpcr_driver"
                              path="%cmf_media.persistence.phpcr.media_basepath%"
                              upload-max-size="2M"
                              upload-allow="all"
                          />
                      </connector>
                  </default>
              </instances>
          </config>
      </container>
      
    • PHP
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
       // app/config/config.php
       $container->loadFromExtension('fm_elfinder', array(
           'instances' => array(
               'default' => array(
                   'locale' => '%locale%',
                   'editor' => 'ckeditor',
                   'connector' => array(
                       'roots' => array(
                           'media' => array(
                               'driver' => 'cmf_media.adapter.elfinder.phpcr_driver',
                               'path' => '%cmf_media.persistence.phpcr.media_basepath%',
                               'upload_allow': array('all'),
                               'upload_max_size' => '2M',
                           ),
                      ),
                   ),
               ),
           ),
      ));
      

Note

The driver service depends on your storage layer. For now, the MediaBundle only provides a PHPCR driver. To make the above configuration work, you need to enable PHPCR either globally on cmf_core.persistence:phpcr or, if you only use the MediaBundle, directly on the bundle at cmf_media.persistence.phpcr.

  1. When using the LiipImagineBundle, add an imagine filter for the thumbnails:

    • YAML
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      # app/config/config.yml
      liip_imagine:
          # ...
          filter_sets:
              # default filter to be used for elfinder thumbnails
              elfinder_thumbnail:
                  data_loader: cmf_media_doctrine_phpcr
                  quality: 85
                  filters:
                      thumbnail: { size: [48, 48], mode: inset }
              # ...
      
    • XML
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      <!-- app/config/config.xml -->
      <?xml version="1.0" charset="UTF-8" ?>
      <container xmlns="http://symfony.com/schema/dic/services">
      
          <config xmlns="http://example.org/dic/schema/liip_imagine">
              <!-- ... -->
              <!-- default filter to be used for elfinder thumbnails -->
              <filter-set name="elfinder_thumbnail" data-loader="cmf_media_doctrine_phpcr" quality="85">
                  <filter name="thumbnail" size="48,48" mode="inset"/>
              </filter-set>
              <!-- ... -->
          </config>
      
      </container>
      
    • PHP
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      // app/config/config.php
      $container->loadFromExtension('liip_imagine', array(
          // ...
          'filter_sets' => array(
              // default filter to be used for elfinder thumbnails
              'elfinder_thumbnail' => array(
                  'data_loader' => 'cmf_media_doctrine_phpcr',
                  'quality'     => 85,
                  'filters'     => array(
                      'thumbnail' => array(
                          'size' => array(48, 48),
                          'mode' => 'inset',
                      ),
                  ),
              ),
              // ...
          ),
      ));
      
  2. Test the elFinder browser by navigating to: http://<yoursite>/app_dev.php/elfinder

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.