Daizu::Plugin::ImageMetadata - add information to 'img' elements
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_heightvalues in the
wc_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.
The alternative text is added, if there isn't already an
altattribute, from the
daizu: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.
altattribute is added to all images that don't have one. If there is no
daizu:altproperty, or if the image isn't stored in Daizu, then an empty value is used because HTML requires that the attribute be present.
If there isn't already a
titleattribute then one might be added using the value of the
dc:titleproperty of the image file, or if that doesn't exist then the
dc: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.
To turn on this plugin, include the following in your Daizu CMS configuration file:
<plugin class="Daizu::Plugin::ImageMetadata" />
- Daizu::Plugin::ImageMetadata->register($cms, $whole_config, $plugin_config, $path)
Registers the plugin as a filter for all articles at or in
- $self->filter_article($cms, $file, $doc)
Does the actual filtering in-place on
$docand returns it.
This software is copyright 2006 Geoff Richards <firstname.lastname@example.org>. For licensing information see this page: