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

AbandonedArchivedYii2-extension

bupy7/yii2-gallery-manager
==========================

This is fork https://github.com/zxbodya/yii2-gallery-manager. Improved and upgraded version of extension.

020PHP

Since Apr 15Pushed 11y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

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

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

Yii2 port of

(frontend part mostly without changes, but backend was rewritten almost completely)

**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

Decencies
---------

[](#decencies)

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

Installation:
-------------

[](#installation)

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

Either run

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

or add

`"zxbodya/yii2-gallery-manager": "*@dev"`

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

Usage
-----

[](#usage)

Add migration to create table for images:

```
class m150318_154933_gallery_ext
    extends zxbodya\yii2\galleryManager\migrations\m140930_003227_gallery_manager
{

}
```

Or better - copy migration to you application.

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

```
public function behaviors()
{
    return [
         'galleryBehavior' => [
             'class' => GalleryBehavior::className(),
             'type' => 'product',
             'extension' => 'jpg',
             'directory' => Yii::getAlias('@contentRoot') . '/images/product/gallery',
             'url' => Yii::getAlias('@web') . '/images/product/gallery',
             'versions' => [
                 'small' => function ($img) {
                     /** @var ImageInterface $img */
                     return $img
                         ->copy()
                         ->thumbnail(new Box(200, 200));
                 },
                 'medium' => function ($img) {
                     /** @var 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::className(),
           // mappings between type names and model classes (should be the same as in behaviour)
           'types => [
               'product' => Product::className()
           ]
       ],
    ];
}
```

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

```
if ($model->isNewRecord) {
    echo 'Can not upload images for new record';
} else {
    echo GalleryManager::widget(
        [
            'model' => $model,
            'behaviorName' => 'galleryBehavior',
            'apiRoute' => 'product/galleryApi'
        ]
    );
}
```

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}}`):

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

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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/f2f9ee20b742a44db8870955cd27b91bb82c14e08dd61a4e096692c9d9d83302?d=identicon)[bupy7](/maintainers/bupy7)

---

Top Contributors

[![bupy7](https://avatars.githubusercontent.com/u/5145037?v=4)](https://github.com/bupy7 "bupy7 (7 commits)")[![zxbodya](https://avatars.githubusercontent.com/u/446117?v=4)](https://github.com/zxbodya "zxbodya (7 commits)")

### Embed Badge

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

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

PHPackages © 2026

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