Yii 1.1: egallery

Simple photo gallery

This extension adds a simple photo gallery.

Photo links can be enhanced to include lightbox or similar by editing views\gallery.php. CSS is located at css\gallery.css.

Makes use of Yii's Cache if available. Currently you will have to clear the cache manually.


  • name = The name of the gallery
  • path = The path to the directory containing the albums (relative to webroot)
  • id = the #ID of the gallery container
  • showNav = Show the navigation menu
  • mimeTypes = Mime types to display
  • createThumbnails = Or use a generic icon
  • thumbnailWidth = The width of generated thumbnails
  • thumbnailHeight = The height of generated thumbnails
  • displayFoldersAsDates = Album folders that are in a format parseable by strtotime should be displayed as a formated date
  • dateFormat = The date format used for output (only used if foldersAreDates = true)
  • imagesPerPage = The number of images to show on each page
  • imagesPerRow = The number of images to show on each row
  • albumsPerPage = The number of albums to show on each page
  • albumsPerRow = The number of albums to show on each row (0 for unlimited)
  • sort_order = Album sort order (asc/desc)




  • Yii 1.0 or above


  • Extract the release file under protected/extensions


Choose a location to store the photos: eg. /images/gallery Ensure that this location is writable by the webserver (if you want thumbnails generated for you).

Create some "albums" in the gallery and put your photos (and optional description.txt) in there eg.

    | +-image1.jpg
    | +-image2.jpg
    | +-image4.jpg
    | +-image5.jpg

If you name your folder by date (eg. 20091120) and create a description.txt you can sort your gallery by date, but show whatever album title you want.

Format of description.txt

Line 1: Album title

Lines 2-n: Album description

Album title
An optional description of the album that will be parsed by Markdown.
It can have multiple lines.

Add the following code to your view:

        array('path' => '/images/gallery',)

Change Log

November 20, 2009 (1.0)

  • Initial release.

November 21, 2009 (1.1)

  • Fixed up CSS styling to be more specific.

November 28, 2009 (1.2)

  • Fixed problem occurring when Yii is installed to a subdirectory.
  • Able to correctly set path relative to Yii install as well as relative to webroot.

December 18, 2009 (1.3)

  • Added cache support.
  • Fixed problem where there would be a long pause while the server generated the thumbnails.

Total 6 comments

#18651 report it
David Urry at 2014/12/06 01:28pm
Demo is failing....

Demo is not working. Link to it is broken: http://www.mcmillan.id.au/dev/yii.

#16430 report it
keripik_jagung at 2014/02/22 05:43am
Merged this extension with fancybox2, and it becomes fancy...!!!
  1. Install this extensions.

  2. Get and install Fancybox2

  3. Open and edit your "gallery.php" file, add this following lines:

$this->widget('application.extensions.fancybox.EFancyBox', array(   
    'target' => '.egallery a',
    'config' => array(),
  1. Enjoy!!!
#10351 report it
behzadkhan at 2012/10/22 06:04am
Path to gallery is not specified or invalid.


Path to gallery is not specified or invalid.


#237 report it
allankliu at 2010/07/29 10:29pm
Good Work, Keep moving forward, please.

It is a working extension for my webapp. However, the requirements for photo gallery could be various. I would like to suggest you to improve it further to cover some more important features.

BTW, my development is XAMPP in Windows, I met some issues in Windows shell execution during generating thumbnail. I have to manually generate them by imagemagick.

MarkDown works, but does it work for UTF-8 for CKJ Languages?

#785 report it
StErMi at 2010/02/28 10:39am
load from the model

it will be a great thing if you will use an array of links instead loading everything from the fs

#866 report it
DarkNSF at 2010/02/15 06:30pm
Excellent Gallery

It would be cool to see this use a CDataProvider like the DataGrid widget.

Leave a comment

Please to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: New BSD License
  • Developed by: scythah
  • Category: Others
  • Votes: +4
  • Downloaded: 3,511 times
  • Created on: Nov 20, 2009
  • Last updated: Jan 11, 2010