Translations of this page:

Image Gallery Component

This component was designed to allow the rapid display of the most recent images anywhere required within Claromentis.

1. Create file called ComponentImageGallery.php and paste in the following code.

 * A component to fetch the images from the specified album in the image gallery and display them on homepage one after another.
 * @author Sweta Phatangare []
class ComponentImageGallery implements TemplaterComponent
	 * Attribute array values:
	 * album_id (int): To specify the album id of Image gallery of which you wish to display the images
	public function Show($attributes)
		global $db;
		$album_id = $attributes['album_id'];
		$res = $db->query("SELECT id, title FROM images where album_id = $album_id ORDER BY RAND()");
		while($row = $res->fetchArray())
			$id = $row['id'];
			$title = $row['title'];
			$image = "/intranet/gallery/thumbnail.php?id=".$id."&prefix=small";
			$url = "/intranet/gallery/details.php?id=".$id."";
			$value .= "<a href=".$url." /><img src = $image></a>";
		return $value;

2. Copy this file into


3. Paste the following component code anywhere on templater file

<component class="ComponentImageGallery">

Suggested location:



components/image_gallery.txt · Last modified: 07/06/2011 10:49 by sweta
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki