PHPackages                             sashsvamir/yii2-gallery-manager - 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. sashsvamir/yii2-gallery-manager

ActiveYii2-extension

sashsvamir/yii2-gallery-manager
===============================

Port of 'zxbodya/yii-gallery-manager'. Extension for yii, that allows to manage image galleries

1713PHP

Since Jul 8Pushed 6y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Gallery Manager usage instructions
==================================

[](#gallery-manager-usage-instructions)

Yii2 port of

#### This port have next features:

[](#this-port-have-next-features)

- saving original file image with original filename

**warning: preview version**

### Features

[](#features)

1. AJAX image upload
2. Optional name and description for each image
3. Possibility to arrange images in gallery
4. Ability to generate few versions for each image with different configurations
5. Drag &amp; Drop

### Dependencies

[](#dependencies)

1. Yii2
2. Twitter bootstrap assets (v3)
3. Imagine library
4. JQuery UI (included with Yii)

### Installation:

[](#installation)

`php composer.phar require --prefer-dist sashsvamir/yii2-gallery-manager "*@dev"`

### Usage

[](#usage)

Add migration to create table for images:

```
class m150318_154933_gallery_ext extends \sashsvamir\galleryManager\migrations\m140930_003227_gallery_manager
{
}
```

Or better - copy migration to your application.

Add GalleryBehavior to your model, and configure it, create folder for uploaded files.

```
public function behaviors()
{
    return [
         'galleryBehavior' => [
             'class' => GalleryBehavior::class,
             'type' => 'product',
             'extension' => 'jpg',
             'directory' => Yii::getAlias('@webroot') . '/images/product/gallery',
             'url' => Yii::getAlias('@web') . '/images/product/gallery',
             'versions' => [
                 'small' => function ($img) {
                     /** @var \Imagine\Image\ImageInterface $img */
                     return $img
                         ->copy()
                         ->thumbnail(new \Imagine\Image\Box(200, 200));
                 },
                 'medium' => function ($img) {
                     /** @var Imagine\Image\ImageInterface $img */
                     $dstSize = $img->getSize();
                     $maxWidth = 800;
                     if ($dstSize->getWidth() > $maxWidth) {
                         $dstSize = $dstSize->widen($maxWidth);
                     }
                     return $img
                         ->copy()
                         ->resize($dstSize);
                 },
             ]
         ]
    ];
}
```

Add GalleryManagerAction in controller somewhere in your application. Also on this step you can add some security checks for this action.

```
public function actions()
{
    return [
       'galleryApi' => [
           'class' => GalleryManagerAction::class,
           // mappings between type names and model classes (should be the same as in behaviour)
           'types' => [
               'product' => Product::class
           ]
       ],
    ];
}
```

Add ImageAttachmentWidget somewhere in you application, for example in editing from.

```
    echo sashsvamir\galleryManager\GalleryManager::widget([
        'model' => $model,
        'behaviorName' => 'galleryBehavior',
        'apiRoute' => 'product/galleryApi',
        'options' => [
            'class' => 'form-group',
        ],
    ]);
```

Done!

Now, you can use uploaded images from gallery like following:

```
foreach($model->getBehavior('galleryBehavior')->getImages() as $image) {
    echo Html::img($image->getUrl('medium'));
}
```

### Options

[](#options)

#### Using non default table name for gallery images(default is `{{%gallery_image}}`):

[](#using-non-default-table-name-for-gallery-imagesdefault-is-gallery_image)

1. Add migration that will create table you need
2. Change `tableName` property in behavior configuration

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 51.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f6536c9f8af43a09edd5f23d3bd78a170cc0441319ebcd42528588dd0285d959?d=identicon)[sashsvamir](/maintainers/sashsvamir)

---

Top Contributors

[![zxbodya](https://avatars.githubusercontent.com/u/446117?v=4)](https://github.com/zxbodya "zxbodya (17 commits)")[![sashsvamir](https://avatars.githubusercontent.com/u/1404421?v=4)](https://github.com/sashsvamir "sashsvamir (13 commits)")[![and800](https://avatars.githubusercontent.com/u/9919211?v=4)](https://github.com/and800 "and800 (1 commits)")[![davidyew](https://avatars.githubusercontent.com/u/544229?v=4)](https://github.com/davidyew "davidyew (1 commits)")[![garando](https://avatars.githubusercontent.com/u/7852028?v=4)](https://github.com/garando "garando (1 commits)")

### Embed Badge

![Health badge](/badges/sashsvamir-yii2-gallery-manager/health.svg)

```
[![Health](https://phpackages.com/badges/sashsvamir-yii2-gallery-manager/health.svg)](https://phpackages.com/packages/sashsvamir-yii2-gallery-manager)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
