]> sipb.mit.edu Git - ikiwiki.git/blob - underlays/basewiki/directive/img.mdwn
move demo back to plugin page
[ikiwiki.git] / underlays / basewiki / directive / img.mdwn
1 The `img` directive is supplied by the [[!iki plugins/img]] plugin.
2
3 This is an image handling directive.  While ikiwiki supports inlining full-size
4 images by making a [[ikiwiki/WikiLink]] that points to the image, using
5 this plugin you can easily scale down an image for inclusion onto a page,
6 providing a link to a full-size version.
7
8 ## usage
9
10         \[[!img image1.jpg size="200x200" alt="clouds"]]
11
12 The image file will be searched for using the same rules as used to find
13 the file pointed to by a [[ikiwiki/WikiLink]].
14
15 The `size` parameter is optional, defaulting to full size. Note that the
16 original image's aspect ratio is always preserved, even if this means
17 making the image smaller than the specified size. You can also specify only
18 the width or the height, and the other value will be calculated based on
19 it: "200x", "x200".
20
21 You can also pass `alt`, `title`, `class` and `id` parameters. These are
22 passed through unchanged to the html img tag. If you include a `caption`
23 parameter, the caption will be displayed centered beneath the image.
24
25 The `link` parameter is used to control whether the scaled down image links
26 to the full size version. By default it does; set "link=somepage" to link
27 to another page instead, or "link=no" to disable the link, or
28 "link=http://url" to link to a given url.
29
30 You can also set default values that will be applied to all later images on
31 the page, unless overridden. Useful when including many images on a page.
32
33         \[[!img defaults size=200x200 alt="wedding photo"]]
34         \[[!img photo1.jpg]]
35         \[[!img photo2.jpg]]
36         \[[!img photo3.jpg size=200x600]]