New version 0.9 has been released! Jun 16, 2015
×

Gallery module

Description

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


Include

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


Public functions

object Gallery::album( $id, $options = [] )
$id integer / string Album identifier can be integer (id) or string (slug)
$options array
  • pageSize (int) - photo count on single page

examples

Gallery::album(1);
Gallery::album('my-album');
stdClass Object
(
    [id] => 1
    [title] => "Album title"
    [thumb] => "/path/to/thumb.jpg"
    [seo_h1] => "Seo album title"
    [seo_title] => "Seo window title"
    [seo_keywords] => "seo, website, keywords"
    [seo_description] => "Seo description"
    [slug] => "my-album"
    [photos] => Array
        (
            [0] => stdClass Object
                (
                    [id] => 1
                    [image] => "/path/to/image.jpg"
                    [thumb] => "/path/to/thumb.jpg"
                    [box] => "<a href=image><img src=thumb></a>"
                )

        )

    [empty] => false
)
IF album with id == 1 or slug == 'my-album' exists
stdClass Object
(
    [id] => ""
    [title] => ""
    [thumb] => ""
    [seo_h1] => ""
    [seo_title] => ""
    [seo_keywords] => ""
    [seo_description] => ""
    [slug] => ""
    [photos] => Array
        (
        )

    [empty] => true
)
IF album is not exist
stdClass Object
(
    [id] => ""
    [title] => "<a href="...">Create album</a>"
    [thumb] => ""
    [seo_h1] => ""
    [seo_title] => ""
    [seo_keywords] => ""
    [seo_description] => ""
    [slug] => ""
    [photos] => Array
        (
        )

    [empty] => true
)
IF album is not exist and user logged in

array Gallery::albums( $options = [] )
$options array
  • pageSize (int) - album count on single page
  • photos (integer) - photos limit (default: 0)
  • where (array) - additional select condition

examples

Gallery::albums();
array of album objects

string Gallery::photo( $id )
$id integer Photo identifier

examples

Gallery::photo(1);
"/path/to/image.jpg"
IF photo with id == 1 exists

void Gallery::plugin( $options = [] )
$options array Fancybox jquery widget options. More info
On all your photos, called as $photo->box, will be apply Fancybox plugin.

string Gallery::pages()
returns pagination html generated by yii\widgets\LinkPager widget.

object Gallery::pagination()
returns yii\data\Pagination object.