ImagePlugin
Use this plugin to control the display and alignment of images using an easy
syntax and support for server-side resizing and thumbnailing. There are a set
of pre-defined layout formats for images as well as a free layout configurability.
Short example:
You type:
%IMAGE{"Westminstpalace.jpg"
type="frame"
align="none"
caption="caption text"
}%
You get:
Images to be displayed can be located
- at the
topic
as specified,
- at the location specified in the IMAGEALBUM preference variable or
- at the current topic as a last resort.
The
topic
and IMAGEALBUM parameters can be of the for
[<web>.]<topic>
.
For example putting
* Set IMAGEALBUM = TWiki.ImagePlugin
into the current topic will search all images at the given topic.
Syntax
%IMAGE{"foo.gif" ...}%
There are four predefined format types (simple, link, thumbnail, frame, float)
that can be used by setting the
type
paramenter (see below). In addition
there is a free-form
format
parameter to specify any other possible html
layout. The Wikipedia format is also supported. See
Wikipedia:Wikipedia:Extended_image_syntax.
(hidden feature:
%IMAGE{"clear"}%
will create a proper clear for your floats
)
Arguments
The image name is mandatory. Further arguments are optional.
Name | Values | Default |
align | left|center|right|none | right |
alt | alt text | image filename |
caption | caption text | empty |
class | (see html specs) | imageFrame, imageFloat, ... depending on the type |
desc | description text | title text |
footer | text to be appended to the html output | empty |
format | image layout format string | set by type argument |
header | text to be prepended to the html output | empty |
height | integer value | image width |
href | hyperlink when clicking on the image | url of the source image |
id | (see html specs) | empty |
mousein | javascript executed if moving the mouse over the image | empty |
mouseout | javascript executed if moving the mouse off the image | empty |
size | geometry specification | image geometry |
style | (see html specs) | empty |
title | title text | alt value |
topic | valid TWiki topic name | topic part of IMGALBUM value or current topic |
type | simple|link|thumb[nail]|frame|float" | empty |
web | valid TWiki web name | web part of IMGALBUM value or current topic |
width | integer value | image width |
Image geometry
The image geometry in the
size
parameter can be specified in a format
<width>[px][x<height>[px]]
,
that is width and height can be given as integers with an optional
px
, where
the height is optional, separated with a 'x' in between. Note, that the given
width and height values are the
maximum width and
maximum height that the
image will have keeping its aspect ratio. If you want to deform it to an extact
measure use the
width
and
height
arguments.
Format specification
Format strings given in
header
,
footer
and
format
may contain the following
pseudo variables:
Name | Value |
$align | value of align argumet |
$alt | value of alt argumet |
$caption | caption text |
$class | value of class argumet |
$desc | value of desc argument |
$dollar | replaced with dollar sign ($) |
$height | image height |
$href | hyperlink url when clicking on an image |
$id | value of id argumet |
$magnifyIcon | enlage-icon |
$mousein | value of mousein argument |
$mouseout | value of mouseout argument |
$n | replaced with a linefeed (\n) |
$nop | replaced with empty string |
$origheight | image height of the original image |
$origsrc | url of the original image (not the resized one) |
$origwidth | image width of the original image |
$percnt | replaced with percent sign (%) |
$src | image source url |
$style | value of style argumet |
$text | link text to be displayed in the "link" layout type |
$title | value of title argument |
$width | image width |
After the layout has been formatted any further TWiki markup that might be
contained is expanded afterwards. Note, that using
$percnt
and
$dollar
evaluation order of TWiki markup can be changed so that arguments are expanded
after the IMAGE tag has been computed, whereas TWiki's default evaluation
order is left-to-right-inside-out.
Examples
-
%IMAGE{"foo.gif" size="100" align="left" caption="This is my caption"}%
(resize to 100 pixels, text flows right, with caption)
-
%IMAGE{"foo.gif" type="thumb" align="center"}%
(Resize to %IMGPLUGIN_THUMBNAIL% size, and center image)
Plugin Settings
- One line description, is shown in the TextFormattingRules topic:
- Set SHORTDESCRIPTION = Control the display and alignment of images using an easy syntax
- Default Thumbnail size (defaults to 180)
- Location of picture used as enlarge icon for thumbnails
- Set IMAGEPLUGIN_MAGNIFY_ICON = /pub/TWiki/ImagePlugin/magnify-clip.png
Plugin Installation Instructions
- Download the ZIP file
- Unzip
ImagePlugin.zip
in your twiki installation directory. Content: File: | Description: |
data/Sandbox/ImagePluginTest.txt | |
data/TWiki/ImagePlugin.txt | |
lib/TWiki/Plugins/ImagePlugin/Core.pm | |
lib/TWiki/Plugins/ImagePlugin.pm | |
pub/Sandbox/ImagePluginTest/STS-32_crew.jpg | |
pub/Sandbox/ImagePluginTest/Tst.png | |
pub/Sandbox/ImagePluginTest/Westminstpalace.jpg | |
pub/TWiki/ImagePlugin/WestminstpalaceSample.png | |
pub/TWiki/ImagePlugin/magnify-clip.png | |
pub/TWiki/ImagePlugin/style.css | |
- Optionally, run
ImagePlugin_installer
to automatically check and install other TWiki modules that this module depends on. You can also do this step manually.
- Alternatively, manually make sure the dependencies listed in the table below are resolved.
Name | Version | Description |
---|
Image::Magick | >=6.2.4.5 | Required. |
- Configure the Plugin:
- TWiki 4.0 and up: Run the configure script to enable the Plugin
- Change the Plugin settings as needed
- Test if the installation was successful:
Plugin Info
--
TWiki:Main.CraigMeyer
--
TWiki:Main.MichaelDaum - 18 Dec 2006