NAME
Daizu::Plugin::DisplayPicture - display scaled-down versions of images in articles
DESCRIPTION
TODO - refactor this to share code with PictureArticle.
This plugin filters articles looking for the special element daizu:display-picture
and replacing it with suitable markup to render the image nicely in the middle of the page. If the image file referred to is too big then it includes a scaled-down version in the page
Note that this plugin is very similar in effect to the Daizu::Plugin::PictureArticle one. The difference is that it allows any article to have pictures displayed in that way, and there can be more than one of them. The PictureArticle plugin is for displaying a single image, where that image (and its metadata) constitutes the whole article.
This example page has several images displayed using this plugin:
http://ungwe.org/blog/2002/12/29/20:21/
To use this plugin, turn it on in the configuration file and then add markup like this to your articles (assuming you're writing them in XHTML):
<daizu:display-picture filename="photo.jpg"/>
CONFIGURATION
TODO - this section is essentially the same as the corresponding one in the PictureArticle documentation, so I should probably just refer to that.
To turn on this plugin, include the following in your Daizu CMS configuration file:
<plugin class="Daizu::Plugin::DisplayPicture" />
By default it will ensure that the image included in the page will not be more than 600 pixels wide or 600 pixels high. The thumbnail image will have the suffix -thm added to its URL just before the file extension. You can change these settings in the configuration file as follows:
<plugin class="Daizu::Plugin::DisplayPicture">
<thumbnail max-width="400" min-height="400"
filename-suffix="-small"/>
</plugin>
This example limits included images to 400 pixels on a side, and will use -small as the suffix on the filename.
If the thumbnail
element is present at all then the max-width
and max-height
values will default to unlimited size. This means that you can specify a maximum width but leave the height unbounded.
You can use different configuration for different websites, or parts of websites, by providing multiple plugin
elements in the configuration file: a default one and others in config
elements with paths.
METHODS
- Daizu::Plugin::DisplayPicture->register($cms, $whole_config, $plugin_config, $path)
-
Registers the plugin to filter articles.
- $self->filter_article($cms, $file, $doc)
-
Do the actual filtering on the content in
$doc
.This returns the same
$doc
value, possibly with modifications. It also returns the extra URLs for any automatically-generated thumbnail images which are to be used.
COPYRIGHT
This software is copyright 2006 Geoff Richards <geoff@laxan.com>. For licensing information see this page: