PHPackages                             johnproza/yii2-gallery - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. johnproza/yii2-gallery

ActiveYii2-extension[Image &amp; Media](/categories/media)

johnproza/yii2-gallery
======================

Images Gallery

023JavaScript

Since Apr 29Pushed 7y ago1 watchersCompare

[ Source](https://github.com/johnproza/yii2-gallery)[ Packagist](https://packagist.org/packages/johnproza/yii2-gallery)[ RSS](/packages/johnproza-yii2-gallery/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Images Gallery
==============

[](#images-gallery)

Images Gallery with react fronend

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist johnproza/yii2-gallery "*"

```

or add

```
"johnproza/yii2-gallery": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Before using you must prepare database

```
php yii migrate --migrationPath=@vendor/johnproza/yii2-gallery/migrations
```

Module setup
------------

[](#module-setup)

Insert into your config file

```
'modules' => [
    'news' => [
        'class' => 'oboom\gallery\Module',
    ],
]
```

Model usage
-----------

[](#model-usage)

Insert into your model file (like behaviors)

```
public function behaviors()
{
    return [
        [
            'class' => 'oboom\gallery\behaviors\AttachGallery',
            'mainPathUpload'=>Yii::$app->params['uploadPath'].'/uploads',
            'mode'=>'multiple', // mode of upload ("single" or "multiple")
            'type' => 'news', // type of gallery (may be have a different string value)
            'thumbSize'=>[
                'x'=>600,
                'y'=>480
            ] // size of thumbSize
        ],
    ];
}
```

Params / path setup
-------------------

[](#params--path-setup)

insert into your params-local.php file params for correct work

```
return [
    ......
    'uploadPath' => '/server/path/to/frontend/web',
    'webUrl' => [
        'back' => 'http://admin.yourwebsite.com',
        'front' => 'http://yourwebsite.com',
    ]
];
```

Widget usage
------------

[](#widget-usage)

Insert into your view file for upload images

```
use oboom\gallery\widgets\GalleryWidgets;
.....
.....

```

Insert into your view file for output images

```
use oboom\gallery\widgets\GalleryWidgets;
.....
.....
