2017 © Pedro Peláez
 

yii2-module yii2-media-manager

Yii2 media manager module

image

mlcsthor/yii2-media-manager

Yii2 media manager module

  • Thursday, June 14, 2018
  • by mlcsthor
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Yii2 Media Manager Module

This module provides a Media Manager integration to your Yii2 application. It is still in its early stages, but feel free to use it, report bugs, and contribute., (*1)

screenshot, (*2)

Demo

https://www.iutbayonne.univ-pau.fr/~klevron/mm/, (*3)

Installation

The preferred way to install this module is through composer., (*4)

Either run, (*5)

composer require "mlcsthor/yii2-media-manager" "*"

or add, (*6)

"mlcsthor/yii2-media-manager" : "*"

to the require section of your application's composer.json file., (*7)

Configuration

Add the following lines in your application configuration :, (*8)

'components' => [
    // ...
    'urlManager' => [
        'enablePrettyUrl' => true,
        'showScriptName' => false,
        'rules' => [    
            'thumbs/<path:.*>' => 'mm/thumb/thumb',
            // ...
        ],
    ],
    // ...
    'fs' => [
        'class' => 'creocoder\flysystem\LocalFilesystem',
        'path' => '@webroot/upload',
    ],
],
'modules' => [
    // ...
    'mm' => [
        'class' => 'mlcsthor\mediamanager\Module',
    ],
],

About Flysystem

This module use Flysystem (via creocoder/yii2-flysystem), a filesystem abstraction which allows you to easily swap out a local filesystem for a remote one., (*9)

You can use a local filesystem as described previously, you should then create an upload folder in the web folder of your Yii2 application. You can also use any adapter provided by Flysystem, take a look at Flysystem and creocoder/yii2-flysystem., (*10)

WARNING : Actually, this module has only been tested with local, ftp and sftp adapters., (*11)

About image thumbnails

This module use Imagine (via yii2-imagine) to generate image thumbnails on demand, you should create a thumbs folder in the web folder of your application., (*12)

Usage

MediaManagerInput

use mlcsthor\mediamanager\widgets\MediaManagerInput;

echo MediaManagerInput::widget([
    'name' => 'test', // input name
    'multiple' => false,
    'clientOptions' => [
        'api' => [
            'listUrl' => Url::to(['/mm/api/list']),
            // 'uploadUrl' => Url::to(['/mm/api/upload']),
            // 'downloadUrl' => Url::to(['/mm/api/download']),
            // 'deleteUrl' => Url::to(['/mm/api/delete'])
        ],
    ],
]);

MediaManagerModal

use mlcsthor\mediamanager\widgets\MediaManagerInputModal;

echo MediaManagerInputModal::widget([
    'name' => 'test', // input name
    'clientOptions' => [
        'api' => [
            'listUrl' => Url::to(['/mm/api/list']),
            // 'uploadUrl' => Url::to(['/mm/api/upload']),
            // 'downloadUrl' => Url::to(['/mm/api/download']),
            // 'deleteUrl' => Url::to(['/mm/api/delete'])
        ],
    ],
]);

The Versions

14/06 2018

dev-master

9999999-dev

Yii2 media manager module

  Sources   Download

The Requires

 

by Maxime Lucas

14/06 2018

1.0

1.0.0.0

Yii2 media manager module

  Sources   Download

The Requires

 

by Maxime Lucas