1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
[[!if test="enabled(img)"
then="In diesem Wiki ist die Direktive: img **aktiviert**."
else="In diesem Wiki ist die Direktive: img **nicht aktiv**; falls dies gewünscht wird, den Admin benachrichtigen."]]
---
The `img` directive is supplied by the [[!iki plugins/img desc=img]] plugin.
This is an image handling directive. While ikiwiki supports inlining full-size
images by making a [[ikiwiki/WikiLink]] that points to the image, using
this directive you can easily scale down an image for inclusion onto a page,
providing a link to a full-size version.
## usage
\[[!img image1.jpg size="200x200" alt="clouds"]]
The image file will be searched for using the same rules as used to find
the file pointed to by a [[ikiwiki/WikiLink]].
The `size` parameter is optional, defaulting to full size.
You can specify only the width or the height, and the other value will
be calculated based on it: "200x", "x200".
If you specify both the width and height, the original image's aspect
ratio will be preserved, even if this means making the image smaller
than the specified size. (However, this is not done for svg images.)
You can also pass `alt`, `title`, `class`, `align`, `id`, `hspace`, and
`vspace` parameters.
These are passed through unchanged to the html img tag. If you include a
`caption` parameter, the caption will be displayed centered beneath the image.
The `link` parameter is used to control whether the scaled image links
to the full size version. By default it does; set "link=somepage" to link
to another page instead, or "link=no" to disable the link, or
"link=http://url" to link to a given url.
The `pagenumber` parameter selects which of multiple images should be rendered;
this is relevant mainly for GIF and PDF source images.
You can also set default values that will be applied to all later images on
the page, unless overridden. Useful when including many images on a page.
\[[!img defaults size=200x200 alt="wedding photo"]]
\[[!img photo1.jpg]]
\[[!img photo2.jpg]]
\[[!img photo3.jpg size=200x600]]
## format support
By default, the `img` directive only supports a few common web formats:
* PNG (`.png`)
* JPEG (`.jpg` or `.jpeg`)
* GIF (`.gif`)
* SVG (`.svg`)
These additional formats can be enabled with the `img_allowed_formats`
[[!iki setup]] option, but are disabled by default for better
[[!iki security]]:
* PDF (`.pdf`)
* `everything` (accepts any file supported by ImageMagick: make sure
that only completely trusted users can
[[upload attachments|ikiwiki/pagespec/attachment]])
For example, a wiki where only `admin()` users can upload attachments might
use:
img_allowed_formats: [png, jpeg, gif, svg, pdf]
[[!meta robots="noindex, follow"]]
|