cinghie / yii2-media
Yii2 Media to manage a files on Yii2 site.
Installs: 548
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- cinghie/yii2-masonry: ^1.0.2
- cinghie/yii2-tinify: ^1.0.2
- cinghie/yii2-traits: @dev
- yiisoft/yii2: ~2.0.14
Requires (Dev)
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2024-12-10 13:41:42 UTC
README
Yii2 Media to manage files on Yii2 site like Wordpress Media Management
Installation
The preferred way to install this extension is through composer.
Either run
$ php composer.phar require cinghie/yii2-media "*"
or add
"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:
$ php yii migrate/up --migrationPath=@vendor/cinghie/yii2-media/migrations
2. Set configuration file
Set on your configuration file:
'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:
'modules' => [
// Yii2 Media
'media' => [
'class' => 'cinghie\media\Media',
'as frontend' => 'cinghie\media\filters\FrontendFilter',
],
]
3. Install FFmpeg
On Linux
apt-get install ffmpeg
whereis ffmpeg
Overrides
Override controller example, on modules config
'modules' => [
'media' => [
'class' => 'cinghie\media\Media',
'controllerMap' => [
'default' => 'app\controllers\DefaultController',
]
]
],
Override models example, on modules config
'modules' => [
'media' => [
'class' => 'cinghie\media\media',
'modelMap' => [
'Media' => 'app\models\media\Media',
'MediaSettings' => 'app\models\media\MediaSettings',
]
]
],
Override view example, on components config
'components' => [
'view' => [
'theme' => [
'pathMap' => [
'@cinghie/media/views/default' => '@app/views/media/default',
],
],
],
],