2017 © Pedro Pelรกez
 

yii2-extension yii2-gallery-manager

Extension for yii, that allows to manage image galleries

image

aquy/yii2-gallery-manager

Extension for yii, that allows to manage image galleries

  • Monday, June 18, 2018
  • by aquy
  • Repository
  • 1 Watchers
  • 0 Stars
  • 312 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 49 Forks
  • 0 Open issues
  • 7 Versions
  • 11 % Grown

The README.md

Gallery Manager usage instructions

Fork of https://github.com/zxbodya/yii2-gallery-manager, (*1)

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 & Drop

Decencies

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

Installation:

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist aquy/yii2-gallery-manager "*", (*4)

or add, (*5)

"aquy/yii2-gallery-manager": "*", (*6)

to the require section of your composer.json file., (*7)

Usage

Add migration to create table for images:, (*8)

class m150318_154933_gallery_ext
    extends aquy\gallery\migrations\m140930_003227_gallery_manager
{

}

Or better - copy migration to you application., (*9)

Add GalleryBehavior to your model, and configure it, create folder for uploaded files., (*10)

public function behaviors()
{
    return [
         'galleryBehavior' => [
             'class' => GalleryBehavior::className(),
             'type' => 'product',
             'directory' => Yii::getAlias('@webroot') . '/images/product/gallery',
             'url' => Yii::getAlias('@web') . '/images/product/gallery',
         ]
    ];
}

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

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., (*12)

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

Done!, (*13)

Now, you can use uploaded images from gallery like following:, (*14)

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

or, (*15)

$image = $model->getBehavior('galleryBehavior')->getImage()
echo Html::img($image->getUrl());

Options

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

The Versions

18/06 2018

dev-master

9999999-dev

Extension for yii, that allows to manage image galleries

  Sources   Download

MIT

The Requires

 

by Bogdan Savluk
by ะะปะตะบัะตะน ะ›ะธั…ะฐั‡ะตะฒ

extension yii2 gallery image

18/06 2018

0.1.3.2

0.1.3.2

Extension for yii, that allows to manage image galleries

  Sources   Download

MIT

The Requires

 

by Bogdan Savluk
by ะะปะตะบัะตะน ะ›ะธั…ะฐั‡ะตะฒ

extension yii2 gallery image

28/04 2018

0.1.3.1

0.1.3.1

Extension for yii, that allows to manage image galleries

  Sources   Download

MIT

The Requires

 

by Bogdan Savluk
by ะะปะตะบัะตะน ะ›ะธั…ะฐั‡ะตะฒ

extension yii2 gallery image

08/11 2016

0.1.3

0.1.3.0

Extension for yii, that allows to manage image galleries

  Sources   Download

MIT

The Requires

 

by Bogdan Savluk
by ะะปะตะบัะตะน ะ›ะธั…ะฐั‡ะตะฒ

extension yii2 gallery image

16/09 2016

0.1.2

0.1.2.0

Extension for yii, that allows to manage image galleries

  Sources   Download

MIT

The Requires

 

by Bogdan Savluk
by ะะปะตะบัะตะน ะ›ะธั…ะฐั‡ะตะฒ

extension yii2 gallery image

24/05 2016

0.1.1

0.1.1.0

Extension for yii, that allows to manage image galleries

  Sources   Download

MIT

The Requires

 

by Bogdan Savluk
by ะะปะตะบัะตะน ะ›ะธั…ะฐั‡ะตะฒ

extension yii2 gallery image

24/05 2016

0.1

0.1.0.0

Extension for yii, that allows to manage image galleries

  Sources   Download

MIT

The Requires

 

by Bogdan Savluk
by ะะปะตะบัะตะน ะ›ะธั…ะฐั‡ะตะฒ

extension yii2 gallery image