key Log In

You are here: wiki.fini > TWiki Web > ImagePlugin

Start of topic | Skip to actions

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:

WestminstpalaceSample.png

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 wink )

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)
    • Set THUMBNAIL_SIZE = 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.
    NameVersionDescription
    Image::Magick>=6.2.4.5Required.
  • 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

Plugin Author: TWiki:Main.CraigMeyer
Copyright: © 2006, TWiki:Main.CraigMeyer, MichaelDaum@WikiRing.com
License: GPL (GNU General Public License)
Plugin Version: 0.4
Change History:  
18 Dec 2006: fixed image lookup order; fixed html formats; added I18N workaround
18 Aug 2006: fixed html errors; removed references to ImgPlugin thus not showing the magnify-clip; some html and css fixes to resemble closer to the MediaWiki examples
17 Aug 2006: width and height arguments had no effect; floating images not clearing proberly on IE
16 June 2006: released into the public
10 May 2006: Initial version by forking ImgPlugin
TWiki Dependency: $TWiki::Plugins::VERSION 1.1
CPAN Dependencies: CPAN:Image::Magick
Other Dependencies:  
Perl Version: 5.8
Benchmarks: GoodStyle nn%, FormattedSearch nn%, ImagePlugin nn%
Plugin Home: TWiki:Plugins/ImagePlugin
Feedback: TWiki:Plugins/ImagePluginDev
Appraisal: TWiki:Plugins/ImagePluginAppraisal

-- TWiki:Main.CraigMeyer
-- TWiki:Main.MichaelDaum - 18 Dec 2006

toggleopenShow attachmentstogglecloseHide attachments
Topic attachments
I Attachment Action Size Date Who Comment
pngpng WestminstpalaceSample.png manage 105.2 K 18 Dec 2006 - 11:36 UnknownUser  
pngpng magnify-clip.png manage 0.3 K 18 Dec 2006 - 11:36 UnknownUser  
elsecss style.css manage 1.3 K 18 Dec 2006 - 11:36 UnknownUser  

This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding wiki.fini? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.ImagePlugin