MiniGallery API

These are the MiniGallery functions available in version 0.7 for you to use in your themes.

getThemeDir()

Returns the path to the theme folder in use.  Use in header.php to set stylesheet, for example:

  1. <link rel="stylesheet" type="text/css" href="<?php echo getThemeDir(); ?>.style.css" />
Warning: unlike most functions, this returns a value rather than directly printing it for you, so you will need to manually show it using 'echo'.

getVersion()

Prints the version of MiniGallery currently installed.  Could be used in footer.php:

  1. <?php getVersion(); ?>

would display something like this:

MiniGallery v0.7 

getAlbums()

Prints a list of album names, each with a link and a number showing how many photos are in each album.

  1. <ul id="albums">
  2. <?php getAlbums(); ?>
  3. </ul> 

getAlbumName()

Prints the name of the album currently selected.

  1. <h1>"<?php getAlbumName(); ?>"</h1> 

getAlbumDate()

Prints the date the selected album was created.

  1. <p>Album created on <?php getAlbumDate(); ?></p> 

getAlbumSize()

Prints the number of images in the selected folder.

  1. <p>Number of images in this album: <?php getAlbumSize(); ?></p> 

isAlbum()

Returns either true or false depending on whether the album selected (i.e. retrieved from the URL, ?album=albumname) exists.  Protects against malicious code being inserted in URL.

isImage()

Returns either true or false depending on whether the image selected (i.e. retrieved from the URL, ?image=imagename) exists.  Protects against malicious code being inserted in URL. 

getThumbnails($pre,$post)

Prints a list of thumbnails for the selected album.  By default $pre and $post are set up to format the thumbnails to be contained in <li></li> tags, but this can be set in the call if you want it to be something else.  For instance, to display using the default settings, use the following:

  1. <ul id="thumbnails">
  2. <?php getThumbnails(); ?>
  3. </ul>

To use DIVs instead, try something like this:

  1. <div id="thumbnailsContainer">
  2. <?php getThumbnails('<div class="thumb">','</div>'); ?>
  3. </div> 

getImageTitle()

Prints the name or title of the selected image.  Note that MiniGallery first checks the image's EXIF tag to see if a UserComment has been set, and if not it will use the file name (removing the .jpg extension).

  1. <h2><?php getImageTitle; ?></h2> 

getPreviewImage()

Prints the preview of the selected image, which is a scaled, watermarked version of the original, created on-the-fly.  The image is contained inside a link that points to the full-sized image, which is also watermarked.

  1. <?php getPreviewImage(); ?>

results in something like this:

<a href="link/to/full/image.jpg"><img src="link/to/preview/image.jpg" alt="Image title" /></a>

getImageDetails($details,$pre,$post)

Returns available information about the selected image, gathered either from the file itself or the EXIF tag if present and filled.  You can set which attributes are returned by quoting any combination in $details when calling.  The attributes below assume you have stored the result in an array called $foo.

  1. <?php $foo = getImageDetails(); ?> 

The output can be further customised by settings $pre and $post, which surround each available detail.  By default, $pre = '' and $post = '<br />', which will show each one on a separate line.  You could, for instance, show them in a bullet list by entering the following:

  1. <ul>
  2. <?php getImageDetails('all','<li>','</li>'); ?>
  3. </ul>