PHPackages                             apolle/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. [Image &amp; Media](/categories/media)
4. /
5. apolle/yii2-gallery-manager

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

apolle/yii2-gallery-manager
===========================

Extension for yii, that allows to manage image galleries

130PHP

Since Aug 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/iswebjscom/yii2-gallery-manager)[ Packagist](https://packagist.org/packages/apolle/yii2-gallery-manager)[ RSS](/packages/apolle-yii2-gallery-manager/feed)WikiDiscussions master Synced yesterday

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)

Gallery manager screenshots (yii 1.x version, new one has bootstrap 3 styles):

[![GalleryManager images list](https://camo.githubusercontent.com/85a947217ba6d34b3f62248f0c77fbc45263e4abac414f251ef534a640ed5891/687474703a2f2f7a78626f6479612e63632e75612f73637275702f63692f6568316e317468366f306338302e706e67 "Gallery Manager Screenshot")](https://camo.githubusercontent.com/85a947217ba6d34b3f62248f0c77fbc45263e4abac414f251ef534a640ed5891/687474703a2f2f7a78626f6479612e63632e75612f73637275702f63692f6568316e317468366f306338302e706e67)

Few more screenshots: [drag &amp; drop upload](http://zxbodya.cc.ua/scrup/6w/64q4icig84oo0.png "Drag & Drop image upload"), [editing image information](http://zxbodya.cc.ua/scrup/za/gfc68h5b4gksg.png "Edit image information"), [upload progress](http://zxbodya.cc.ua/scrup/8v/tijrezh7oksk8.png "upload progress"),

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

`composer require apolle/yii2-gallery-manager`

or add

`apolle/yii2-gallery-manager`

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(but be sure to **remove namespace from it** - it should be in global namespace)

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

[](#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

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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/b354b645894b090b645f5bcd516ef887bb5cd0749c22c8cfd528d3c22d41deba?d=identicon)[jackchen](/maintainers/jackchen)

---

Top Contributors

[![iswebjscom](https://avatars.githubusercontent.com/u/15866961?v=4)](https://github.com/iswebjscom "iswebjscom (7 commits)")

### Embed Badge

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

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

###  Alternatives

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)[humanmade/tachyon-plugin

Rewrites WordPress image URLs to use Tachyon

87338.5k2](/packages/humanmade-tachyon-plugin)

PHPackages © 2026

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