The Walden Effect: Farming, simple living, permaculture, and invention.

img

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 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 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:

These additional formats can be enabled with the img_allowed_formats [[!iki setup]] option, but are disabled by default for better [[!iki security]]:

For example, a wiki where only admin() users can upload attachments might use:

img_allowed_formats: [png, jpeg, gif, svg, pdf]


Join the Walden Effect!

Download a free copy of Small-Scale No-Till Gardening Basics when you subscribe to our behind-the-scenes newsletter.

Anna Hess's books
Want more in-depth information? Browse through our books.

Or explore more posts by date or by subject.

About us: Anna Hess and Mark Hamilton spent over a decade living self-sufficiently in the mountains of Virginia before moving north to start over from scratch in the foothills of Ohio. They've experimented with permaculture, no-till gardening, trailersteading, home-based microbusinesses and much more, writing about their adventures in both blogs and books.



Want to be notified when new comments are posted on this page? Click on the RSS button after you add a comment to subscribe to the comment feed, or simply check the box beside "email replies to me" while writing your comment.






profile counter myspace



Powered by Branchable Wiki Hosting.

Required disclosures:

As an Amazon Associate, I earn a few pennies every time you buy something using one of my affiliate links. Don't worry, though --- I only recommend products I thoroughly stand behind!

Also, this site has Google ads on it. Third party vendors, including Google, use cookies to serve ads based on a user's prior visits to a website. Google's use of advertising cookies enables it and its partners to serve ads to users based on their visit to various sites. You can opt out of personalized advertising by visiting this site.