img: Support sizes like 200x. Closes: #475149

master
Joey Hess 2008-09-09 15:20:06 -04:00
parent 7a680431ed
commit 5d53fab853
3 changed files with 7 additions and 3 deletions

View File

@ -65,9 +65,10 @@ sub preprocess (@) { #{{{
my $r;
if ($params{size} ne 'full') {
my ($w, $h) = ($params{size} =~ /^(\d+)x(\d+)$/);
my ($w, $h) = ($params{size} =~ /^(\d*)x(\d*)$/);
error sprintf(gettext('bad size "%s"'), $params{size})
unless (defined $w && defined $h);
unless (defined $w && defined $h &&
(length $w || length $h));
my $outfile = "$config{destdir}/$dir/${w}x${h}-$base";
$imglink = "$dir/${w}x${h}-$base";

1
debian/changelog vendored
View File

@ -5,6 +5,7 @@ ikiwiki (2.64) UNRELEASED; urgency=low
* ddate: Stop clobbering timeformat when not enabled.
* progress: New plugin to generate progress bars (willu)
* Add allow_symlinks_before_srcdir to config so websetup doesn't eat it.
* img: Support sizes like 200x. Closes: #475149
-- Joey Hess <joeyh@debian.org> Mon, 08 Sep 2008 19:21:20 -0400

View File

@ -21,7 +21,9 @@ the file pointed to by a [[ikiwiki/WikiLink]].
The `size` parameter is optional, defaulting to full size. Note that the
original image's aspect ratio is always preserved, even if this means
making the image smaller than the specified size.
making the image smaller than the specified size. You can also specify only
the width or the height, and the other value will be calculated based on
it: "200x", "x200".
You can also pass `alt`, `title`, `class` and `id` parameters. These are
passed through unchanged to the html img tag. If you include a `caption`