Extension:SmoothGallery

This is an extension that integrates JonDesign's SmoothGallery, which is a set of Javascript and CSS that lets you make picture galleries. A number of features are available from SmoothGallery, and this extension aims to be an easy to use, and full featured integration with MediaWiki. JonDesign's SmoothGallery is released under the GPL.

Arguments
The following arguments are available to change the behavior of the gallery:


 * width : A greater than zero number in pixels to modify the width of the gallery.
 * height : A greater than zero number in pixels to modify the height of the gallery.
 * showarrows : Set to "false" to disable the showing of the arrow buttons.
 * showcarousel : Set to "false" to disable the carousel.
 * showinfopane : Set to "false" to disable the infopane.
 * timed : Set to "true" to make a timed slideshow.
 * delay : A greater than zero number in milliseconds to change the delay when using a timed slideshow.
 * special : Create a link to a special page; this will allow you to link to galleries instead of embedding them. The number of images available for this type of gallery will be restricted by the length of a url.

Syntax examples
To make a basic gallery, put a line break delimited list inside of tags like so:

Image1.jpg Image2.gif Image3.png

To make a timed slideshow without the carousel, arrow buttons, and infopane; and with a width of 600px, a height of 500px, and a delay of 4000ms; you would do the following:

 Image1.jpg Image2.gif Image3.png

To make a link called "Hey look, a link!" to a special page with the previous gallery:

 Image1.jpg Image2.gif Image3.png

The extension will make thumbnails for the carousel, and for images that do not fit in the gallery. When a user clicks an image in the carousel, it will bring he/she to the image's wiki page. The infopane uses the image name as the image title, and the image's description from the image page as the description. Images that are missing or typo'd will be ignored by the gallery. If all images are missing, the gallery will output an error, listing the missing images, and ask the user to ensure all images are correct.

Live examples
You can view live working examples here.

Requirements

 * JonDesign's SmoothGallery
 * $wgUseImageResize must be enabled

Installation
First of all, please always try to use the newest version. Until this extension is no longer experimental it is likely to change a bit and get a bunch of bugfixes. I will *not* support older versions as of now. It is possible to use this extension with MediaWiki 1.6, but you'll need to add a hook to includes/SkinTemplate.php called "BeforePageDisplay". Take a look at MediaWiki 1.7+ to see where you need to add it.

You'll need to perform the following steps to get SmoothGallery working:


 * 1) Download SmoothGallery and untar it into your extensions directory
 * 2) * Notice if you download SmoothGallery 2.0, you'll need to rename some of the javascript files; see: Extension talk:SmoothGallery
 * 3) Download the extension using the link above, and drop it into your extensions directory
 * 4) Perform any required bugfixes mentioned below
 * 5) Add the following lines to your LocalSettings.php file, where $wgSmoothGalleryExtensionPath is the relative URL to the SmoothGallery directory, and $wgSmoothGalleryDelimiter is the delimiter of your choosing (the default is \n):
 * include("extensions/SmoothGallery.php");
 * $wgSmoothGalleryExtensionPath = "/mediawiki/extensions/smoothgallery";
 * $wgSmoothGalleryDelimiter = "\n";

Fix the javascript edit toolbar
There is a MediaWiki bug in skins/common/wikibits.js that causes issues when you use Mootools.js (which SmoothGallery uses). The problem description and solution can be found here. This bug has been marked fixed, and should be included in MediaWiki 1.10+.

Fix the jd.gallery.css
The jd.gallery.css that comes from SmoothGallery has an issue when you set showarrows="false". Change:

.jdGallery a.open {       left: 0; top: 0; width: 100%; height: 100%; }

to:

.jdGallery a.open {       left: 0; top: 0; /*       width: 100%; height: 100%; */ }

1.1a

 * Allow multiple modes of fallback when javascript isn't available including image-only, image with warning, and plain gallery.
 * Add support for SmoothGallery 2.0 features
 * Save galleries in database for use on special page
 * Allow image descriptions like regular galleries

1.1b

 * Refactor code
 * Break apart parsing and rendering (why, oh why did I do this to myself?)
 * Move most functions into the class
 * Try to emulate the regular gallery class, so that this plugin can be used as an API if needed
 * Only create new database rows on save page, not on purge
 * Recreate cache in database on purge

1.1c

 * Pull out the special page and database stuff. It doesn't add much, and using wiki pages for that kind of thing is much more tested and reliable. I recommend creating a "Gallery" and "Gallery_Talk" namespace, and use those for linkable galleries.

1.1d

 * Selectively turn off HistoryManager for iPhone
 * Fetch image list via AJAX, and preload images using SmoothGallery's built in preloader

1.0h

 * Fixed a problem with boolean values being passed incorrectly between the special page and the extension
 * Changed the way images are looked up. Images can now also be added like "Image:Imagename.jpg" instead of just "Imagename.jpg"

1.0g

 * return true at the end of addSmoothGalleryJavascriptAndCSS; if a hook doesn't return it can cause problems for other extensions that use the same hook

1.0f

 * Changed "gmp_strval( gmp_random(1) )" to "mt_rand" for better compatibility

1.0e

 * Added a special page so that you can link to galleries instead of embedding them into pages
 * You can use this like imagesGoHere
 * All options available should work in the special page
 * This was tested in MediaWiki 1.6-1.9 (so it should work, tell me if not!)

1.0d

 * Parse templates before rendering html

1.0c

 * Now check to see if an image object is null before trying to make a thumbnail of it.

1.0b

 * Added a configuration option ($wgSmoothGalleryDelimiter) to choose your own delimiter
 * Changed default delimiter from, to \r (it seems a comma is a valid character in image names)

1.0a

 * Initial released version