NAME

Daizu::Plugin::ImageMetadata - add information to 'img' elements

DESCRIPTION

This plugin filters articles and adds additional attributes to img elements when appropriate.

TODO - how it finds the image file

The following information can be added:

width and height

These attributes are filled in (if neither of them are present already) using the size of the image file as recorded by Daizu. The size comes from the image_width and image_height values in the wc_file table in the database. This information is only available if the image file has a MIME type like 'image/*', and if the Image::Size module knows how to extract the size for a the type of image. The bitmap formats you're likely to use on websites are all supported (PNG, JPEG, and GIF) as well as a few others.

alt

The alternative text is added, if there isn't already an alt attribute, from the daizu:alt property of the image file. This allows you to store appropriate alternative text with the image so that it can be reused automatically whenever the image is used.

An alt attribute is added to all images that don't have one. If there is no daizu:alt property, or if the image isn't stored in Daizu, then an empty value is used because HTML requires that the attribute be present.

title

If there isn't already a title attribute then one might be added using the value of the dc:title property of the image file, or if that doesn't exist then the dc:description property. If the image doesn't have either then this attribute isn't added.

Special case: this property isn't added if the image file is the same file as the article being filtered. This happens when you publish an image as an article using Daizu::Plugin::PictureArticle. In that case the title and description of the image file will be displayed in the article just above the image itself, so there seems little point repeating them.

CONFIGURATION

To turn on this plugin, include the following in your Daizu CMS configuration file:

<plugin class="Daizu::Plugin::ImageMetadata" />

METHODS

Daizu::Plugin::ImageMetadata->register($cms, $whole_config, $plugin_config, $path)

Registers the plugin as a filter for all articles at or in $path.

$self->filter_article($cms, $file, $doc)

Does the actual filtering in-place on $doc and returns it.

COPYRIGHT

This software is copyright 2006 Geoff Richards <geoff@laxan.com>. For licensing information see this page:

http://www.daizucms.org/license/