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_widthandimage_heightvalues in thewc_filetable 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
altattribute, from thedaizu:altproperty 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
altattribute is added to all images that don't have one. If there is nodaizu:altproperty, 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
titleattribute then one might be added using the value of thedc:titleproperty of the image file, or if that doesn't exist then thedc:descriptionproperty. 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
$docand returns it.
COPYRIGHT
This software is copyright 2006 Geoff Richards <geoff@laxan.com>. For licensing information see this page: