New version 0.9 has been released! Jun 16, 2015

Gallery module


Gallery module helps you to create live editable photo galleries on frontend.


use yii\easyii\modules\gallery\api\Gallery;

Public functions

object Gallery::cat( $id_slug )
$id_slug integer / string Category identifier can be integer (id) or string (slug)
Returns CategoryObject or null if not found.

array Gallery::tree()
Returns array of categories in tree structure.

array Gallery::cats()
Returns array of categories in flat structure.

array Gallery::last( $limit = 1, $where = [] )
$limit integer Count of last photos
$where mixed additional condition, details
Returns array of PhotoObject

object Gallery::get( $id )
$id integer Photo identifier
Returns PhotoObject or null if not found.

string Gallery::plugin()
Apply Fancybox plugin on all photos, called as box() function.


Public Properties

$title string Category title
$slug string Category slug
$image string Path to image attached to category
$model yii\db\ActiveRecord Category ActiveRecord object

Public Functions

string thumb( $width, $height = null, $crop = true )
$width int Thumbnail width
$height int Thumbnail height
$crop boolean Crop or resize image to thumbnail sizes
Returns path to image thumbnail

Public Functions

array photos( $options = [] )
$options array
  • where (mixed) - additional condition, details
  • pagination (array) - properties for Pagination object.
Returns array of PhotoObject

string pages()
Returns pagination html generated by yii\widgets\LinkPager widget.

object pagination()
Returns yii\data\Pagination object.


Public Properties

$image string Path to image
$description string Photo description
$rel string <img> rel attribute

Public Functions

string box( $width, $height )
$width int Thumbnail width
$height int Thumbnail height
Returns Fancybox scripted image thumbnail