2017 © Pedro Peláez
 

yii2-extension yii2-media

Yii2 Media to manage a files on Yii2 site.

image

cinghie/yii2-media

Yii2 Media to manage a files on Yii2 site.

  • Thursday, May 24, 2018
  • by cinghie
  • Repository
  • 1 Watchers
  • 1 Stars
  • 133 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 14 % Grown

The README.md

Yii2 Media

License Latest Stable Version Latest Release Date Latest Commit Total Downloads, (*1)

Yii2 Media to manage files on Yii2 site like Wordpress Media Management, (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

$ php composer.phar require cinghie/yii2-media "*"

or add, (*5)

"cinghie/yii2-media": "*"

Configuration

1. Update yii2-media database schema

Make sure that you have properly configured db application component and run the following command:, (*6)

$ php yii migrate/up --migrationPath=@vendor/cinghie/yii2-media/migrations

2. Set configuration file

Set on your configuration file:, (*7)

'modules' => [ 

    // Yii2 Media
    'media' => [
        'class' => 'cinghie\media\Media',
        'mediaNameType' = 'casual'; // casual or original
        'mediaPath' => '@frontend/web/media/',  
        'mediaThumbsPath' => '@frontend/web/media/thumbs/',  
        'mediaURL' => $params['media']['mediaURL'],  
        'mediaThumbsURL' => $params['media']['mediaThumbsURL'],  
        'mediaRoles' => ['admin'],
        'mediaType' = ['jpg','jpeg','gif','png','csv','xls','xlx','pdf','txt','doc','docs','mp3','mp4'];  
        'tinyPngAPIKey' => 'YOUR_TINIFY_API_KEY',
        'showTinify' => false,
        'showTitles' => false
    ],

]   

2. Set frontend filter

To disable media management on frontend, set on config:, (*8)

'modules' => [ 

    // Yii2 Media
    'media' => [
        'class' => 'cinghie\media\Media',
        'as frontend' => 'cinghie\media\filters\FrontendFilter',
    ],

]   

3. Install FFmpeg

On Linux, (*9)

apt-get install ffmpeg

whereis ffmpeg

Overrides

Override controller example, on modules config, (*10)

'modules' => [ 

    'media' => [
        'class' => 'cinghie\media\Media',
        'controllerMap' => [
            'default' => 'app\controllers\DefaultController',
        ]
    ]

],

Override models example, on modules config, (*11)

'modules' => [ 

    'media' => [
        'class' => 'cinghie\media\media',
        'modelMap' => [
            'Media' => 'app\models\media\Media',
            'MediaSettings' => 'app\models\media\MediaSettings',
        ]
    ]

],

Override view example, on components config, (*12)

'components' => [ 

    'view' => [
        'theme' => [
            'pathMap' => [
                '@cinghie/media/views/default' => '@app/views/media/default',
            ],
        ],
    ],

],

The Versions

24/05 2018

dev-master

9999999-dev https://github.com/cinghie/yii2-media

Yii2 Media to manage a files on Yii2 site.

  Sources   Download

BSD-3-Clause BSD 3-Clause

The Requires

 

wordpress yii2 upload module media attachments yii2 attachments yii2 media yii2 upload yii2 media wordpress