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
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
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.
+-images/ +-gallery/ +-sample/ | +-image1.jpg | +-image2.jpg +-sample2/ | +-image4.jpg | +-image5.jpg +-sample3/ +-description.txt +-image6.jpg +-image7.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:
$this->widget('application.extensions.gallery.EGallery', 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.