1 The `img` directive is supplied by the [[!iki plugins/img desc=img]] plugin.
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 directive you can easily scale down an image for inclusion onto a page,
6 providing a link to a full-size version.
10 \[[!img image1.jpg size="200x200" alt="clouds"]]
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]].
15 The `size` parameter is optional, defaulting to full size.
16 You can specify only the width or the height, and the other value will
17 be calculated based on it: "200x", "x200".
19 If you specify both the width and height, the original image's aspect
20 ratio will be preserved, even if this means making the image smaller
21 than the specified size. (However, this is not done for svg images.)
23 You can also pass `alt`, `title`, `class`, `align`, `id`, `hspace`, and
25 These are passed through unchanged to the html img tag. If you include a
26 `caption` parameter, the caption will be displayed centered beneath the image.
28 The `link` parameter is used to control whether the scaled image links
29 to the full size version. By default it does; set "link=somepage" to link
30 to another page instead, or "link=no" to disable the link, or
31 "link=http://url" to link to a given url.
33 The `pagenumber` parameter selects which of multiple images should be rendered;
34 this is relevant mainly for GIF and PDF source images.
36 You can also set default values that will be applied to all later images on
37 the page, unless overridden. Useful when including many images on a page.
39 \[[!img defaults size=200x200 alt="wedding photo"]]
42 \[[!img photo3.jpg size=200x600]]
46 By default, the `img` directive only supports a few common web formats:
49 * JPEG (`.jpg` or `.jpeg`)
53 These additional formats can be enabled with the `img_allowed_formats`
54 [[!iki setup]] option, but are disabled by default for better
58 * `everything` (accepts any file supported by ImageMagick: make sure
59 that only completely trusted users can
60 [[upload attachments|ikiwiki/pagespec/attachment]])
62 For example, a wiki where only `admin()` users can upload attachments might
65 img_allowed_formats: [png, jpeg, gif, svg, pdf]
67 [[!meta robots="noindex, follow"]]