PHP code example of sya / yii2-gallery

1. Go to this page and download the library: Download sya/yii2-gallery library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sya / yii2-gallery example snippets


"sya/yii2-gallery": "~1.0"

use sya\gallery\Module;
'modules' => [
    'gallery' => [
        'class' => 'sya\gallery\Module',
        'syaDirPath' => '@webroot/',
        'syaDirUrl' => '@web/',
        'syaDirUpload' => 'uploads',
    ],
]

use sya\gallery\models\Gallery;
$form->field($model, 'gallery'])->widget(Gallery::className(), [
  'columns' => [
      'status' => [
          'title' => 'Status',
          'displayType' => Gallery::SYA_TYPE_COLUMN_DROPDOWN,
          'items' => [
              '0' => 'Ẩn',
              '1' => 'Hiện'
          ]
      ],
  ]
]),

use sya\gallery\Image;
$form->field($model, 'image', ['horizontalCssClasses' => []])->widget(Image::className(), [
  'class_button' => 'form-control button_color ',
])