zantknight/yii2-gallery4

Gallery manager for bootstrap4

Installs: 391

Dependents: 1

Suggesters: 0

Security: 0

Stars: 3

Watchers: 2

Forks: 0

Open Issues: 1

Type:yii2-extension

v1.1.1 2023-12-07 09:35 UTC

This package is auto-updated.

Last update: 2024-05-07 10:44:24 UTC


README

Gallery manager for bootstrap4

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist zantknight/yii2-gallery4 "*"

or add

"zantknight/yii2-gallery4": "*"

to the require section of your composer.json file.

Usage

  1. Migrate to create gallery table by calling this command
    php yii migrate --migrationPath=@vendor/zantknight/yii2-gallery4/migrations
    
  2. Update config/web.php
    return [
        ...
        'modules' => [
            'gallery4' => [
                 'class' => 'zantknight\yii\gallery\Module',
             ],
        ]
    ]
  3. Add this behavior to your model
     ...
     use zantknight\yii\gallery\Gallery4Behavior;
    
     class YourModel extends \yii\db\ActiveRecord
     {
         ...
    
         public function behaviors()
         {
             return [
                 ...
                 [
                     'class' => Gallery4Behavior::className(),
                     'model' => $this
                 ]
             ];
         }
     }
  4. Put this onto your view
    <?= \zantknight\yii\gallery\Gallery4Widget::widget([
         'ownerModel' => $model,
         'multiple' => true
     ]); ?>
    Description
    • ownerModel Model class where is used by view
    • multiple Multiple upload status
  5. Put this chunk in params.php
     return [
         ...
         'bsVersion' => '4.x',
     ];
  6. Create folder "media" in your "web" folder
  7. You will get something like this alt text alt text alt text alt text
  8. For image administration, go to Module Gallery4 Url (/gallery4/admin) and you will get something like this alt text