Yii 1.1: fbgallery

Add a pictures gallery in a page.

fbgallery include a nice photo gallery into your website.

Also, it can be used as a showroom or as a base for a little shop.

fbgallery description and facilities


The fbgallery is structured in albums and collections (of albums).


Is a page which includes thumbnails of gallery or when it is used in shop mode, will display pictures and information for a specific product.


In administration mode, a collection will display a cover for every album which exists, and will permit you to select which albums will be displayed to visitors in that collection.

The covers of albums may be sorted to be display in any order you like. Clicking on a cover of an album, will redirect the visitor to album's page.

Title and description

Every album and every collection may have a title and a description. Those can be used as page heading.


The fbgallery is multilingual. You can use how many languages you like.

Album's and collection's title, description and information about every picture, support translation.


Administration is separate for two levels: editors and admins. Editors are logged users and have limited rights, while administrators are a powerful category of logged users.

Available languages: English, Romanian.

Editor Panel

Editor panel is a draggable panel, which you can place it anywhere you like. It is contextual for album and collection and according with settings made by administrators.

Control Panel

Control Panel is accessible only for administrators. It is structured in 5 categories:

Gallery - structured in 6 subcategories:
    Image resize,

Default values can be loaded for:

every category,
all categories in block
individual for every setting.

Every setting from Control Panel has its own help as a tooltip.


The albums support the pagination. The number of pictures displayed in every page is selected in Control Panel. Pagination is not applicable when it is used shop mode.

If isn't used pagination, you can set how many pictures will be displayed in a row.


Multiple files uploader, based on plupload plug-in.

The uploader is multilingual.

Unique file name can be generated to avoid overwriting existing photos in the album.

Uploader can set maximum file size dimension to be uploaded and can be set the maximum number of pictures to be uploaded in every album. Uploader limitation: In safari for windows pictures will be loaded only file by file. Not working with IE previous to version 9. Not tested in apple safari.

Picture information

Picture's title permit to use a wide range of characters, including arabic characters.

Alternatively, picture's title can be displayed as an informational box under the picture.

Use title when you need to display a very short information or use informational box when you need to display a long information, as Description, Price, Link and so on.

Informational box may be as big as you wish, and have support for plain text or html.

Wysiwyg support - cleditor

For every field which accept html, a wysiwyg editor is available with a single click.

Predefined information

Now it is possible to set predefined information for title or informational box for uploaded pictures.

Available options to be used as predefined: filename, page metatitle or predefined content.

Image removal

Multiple images can be selected to be deleted in block.

You can clear the gallery with just a click (plus confirmation).

Resizable thumbnails

The size of thumbnail can be set from Control Panel.

Thumbnail aspect

Can be set as square, landscape or portrait, from Control Panel.


The nice tooltip replace the ugly bubble displayed when mouse is over thumbnail. Can be used or not, selecting from Control Panel.


Supports interchangeable css themes.


Option to use album page as page for item of shop, with a bigger image as cover and a set of mini-thumbnails under the cover. Near thess pictures, you have a place to describe product from your shop page.

The shop mode will permit you to predefine some values to avoid repetition.

Files structure

Extension files structure has been changed, for a better future development.


Included the plupload as uploader.

Included the newest version of fancybox (unfortunately last the free).

Included cleditor as wysiwyg editor.

Extension is XHTML valid;

Tested in Linux and windows.

Tested browsers: Firefox, Chrome, Opera, Safari, IE

The administration mode work with: Firefox, Chrome, Opera, Safari, IE9

Use Yii version: 1.1.8

How to...?

Install fbgallery:

Extract the archive in your protected/extensions folder (or in any other place in your application).

In the root of your website create one folder named "galleries" and make it writable. This is default option, but you can use any folder. For this, you need to set its path relative to approot in Control Panel->Gallery->Structure->Container folder for galleries.

Import in the database the file fbgallery.sql from sql folder and set in config/main.php to use "tablePrefix"=>'tbl_'. If you use another tablePrefix, change the name of tables, using your own prefix.

Use fbgallery:

Just include in your page next code:


If you install the extension in another place, not in extensions folder, only adjust the above code.


When you start to use fbgallery, decide what type of thumbnail will be used: landscape, square or portrait.

All uploaded pictures will be resized to best fit in thumbnail. If you later will change aspect of the thumbnail, this will affect how images are displayed.

Customize fbgallery if is needed:

To customize how fbgallery will treat users level, change the function personalisedMode() from /libs/general/FBAccess.php

To customize how the extension will get the page's metatitle, adjust the function getPageTitle() from fbgallery.php to meet to your need.

If you will include fbgallery into a cms, which automatic generate pages with own ID, you will customize the function getUrlRouteStructure() from fbgallery.php, to be according with your url structure.

Change the name and the information about an album or a collection?

Click on its title. An text editor will appear. Change the value and click on Save button.

Switch to shop mode?

In Control panel->Gallery->Shop click on the "Set standard shop" button.


Check your ini.php file to not use E_STRICT error reporting.

Before comment here to ask help, please contact and ask me, using demo site.

Total 20 comments

#14206 report it
Ravi Bhalodiya at 2013/07/26 05:14am
Cant create multiple albums????


I used this extension in my application. but when i create an album this show for remove icon. How can i create multiple albums?? How to configure RBAC(Role Based Access Control) with this extension?

Thankx in Advanced.

#13478 report it
Paul Sandel at 2013/05/31 12:16am

This is exactly what I was looking for and works out of the box with little configuration. Thanks!

#10063 report it
balrok at 2012/10/03 04:38am
Not usable

This extension looks at the first impression very nice, but the author mixed static and instanciated concepts of classes so much, that this is beyond repair.. I guess in older PHP versions the errors generated by this could be suppressed but I wasn't able to get it running :/

#8500 report it
matricks at 2012/06/07 12:27pm

Please insert fbgallery extension into About page too. There you will create an album. Remove your album from home page and create instead a collection. In that collection, you will find all your albums. In this case you will find just that you will create in About page. If you will add some more pages and create albums, you will find all in your collection. Then you can choose which albums will have a cover in your collection.

#8497 report it
messema at 2012/06/07 11:11am
An example

@matricks View this page for an example: http://www.messinaemanuele.com/demo/index.php Login User: admin Pass: admin I can create an album (not same albums) and i can not place it inside a collection. What's wrong?

Thank you very much.

#8494 report it
matricks at 2012/06/07 09:11am

You must create some albums. In every collection you will have all albums. If you need to include some albums in your collection, only need to check it.

#8493 report it
messema at 2012/06/07 08:59am
Multiple Album into collection

I have installed fbgallery in my application without no errors. But i can not create multiple album into collection. I can create only album or only collection without albums. Why?

Yii version: 1.1.10

#7689 report it
Anatoly Rugalev at 2012/04/09 07:02pm
Speed up

Hello, Matricks. Thanks for your great work!

I modified run() function for speed up of AJAX and upload requests, because render takes a lot of time on my tiny server. I think, you can include this in the next release.

public function run()
    if(isset($_SERVER["CONTENT_TYPE"]) && strstr($_SERVER["CONTENT_TYPE"], 'multipart/form-data')) //upload
            return Uploader::uploadFiles();
    elseif(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') //ajax
        //process post requests if exists
        if($this->levelAccess === 2)
                return operations::switchToFunction();
        //publish files
        //render page

Regards, Anatoly

#4920 report it
Nebi at 2011/08/29 09:53am
Solution - Trying to get property of non-object

Solution - Trying to get property of non-object: The previous solution to add a record into database doesn't help if you're adding galleries dynamicaly.

In FBGallery.php change the line 201 - if the method unserialize doesn't have data to unserialize it throws error:

if (isset($this->gmodel->imgsOrder)) {$this->imgsOrder = unserialize($this->gmodel->imgsOrder);}
#4305 report it
n13 at 2011/06/23 08:01am
next error

I went into my database 'galleries' table and I just drop in a row and set pid = 1.

and "Trying to get property of non-object" error solved but now I get this...

Non-static method Uploader::loadUploaderConfiguration() Any soluttion? Thx

#4289 report it
Phate at 2011/06/22 01:42pm
Trying to get property of non-object Error


Go into your database 'galleries' table and just drop in a row and set pid = 1.

When you call your FBGallery widget use the pid you used in the table row.

#4188 report it
Ostovar IT at 2011/06/15 06:45am

i have an error on this line: $this->imgsOrder = unserialize($this->gmodel->imgsOrder);

the error msg is: Trying to get property of non-object

how can i pass this error?

#3835 report it
pchu0101 at 2011/05/12 10:18pm
picture won't pop out once upgraded to 1.1.7

need help to fix this, thx

#3774 report it
swampone at 2011/05/07 05:38am
This is Great!!!

This extension is awesome!!! Took no more than 2 minutes to get it working. It could have took me days to achieve what this extensions does. Big Up!!!

#3758 report it
bonnie at 2011/05/05 02:42pm
Id Error

Undefined index: id FBGallery.php(184). My local machine is windows and running on Wamp and after installing this module I have the above error. Please help.

#3664 report it
dickreuter at 2011/04/26 07:06pm
Trying to get property of non-object

Has anybody ever figured out how go solve the "Trying to get property of non-object" error message? I get it as well although I was following the instructions word for word and pid is set to 1.


#3392 report it
matricks at 2011/04/08 05:12pm


In FBGallery.php line 154, adjust code to work for your configuration:

154 if(!Yii::app()->user->isGuest && Yii::app()->user->name ==='admin') $this->userType = 'admin';

#3386 report it
lukBB at 2011/04/08 08:28am
Can't delete pictures

Hallo !! I downloaded fbgallery, and installation went without problems. I was able to configure gallery for every new user. But problem is, user can't delete uploaded pictures. After picter was deleted, after refreshing picture is back :) Another thing I haven't figure out yet, I can't get configuration console opened. I mean when I log in as admin, I still have only one link to upload picture, but admin links are not visible. I'm using rights. Thank for any feedback Regards

#3351 report it
peasandcarrots at 2011/04/05 09:38am
No special characters allowed in title?

I like this extension, except for the fact that it doesn't seem to allow, for instance, apostrophes, slashes or French characters as picture titles.

#3130 report it
tarakarama at 2011/03/19 04:52am
How to change access rules?


Installed application successfully and working very well. Awesome application.

I would like to change access rules. Particularly, I don't want editors to delete images. How can i achieve it? Could you please suggest me?

Thank you in advance

Leave a comment

Please to leave your comment.

Create extension