]> sipb.mit.edu Git - ikiwiki.git/commitdiff
img: Support sizes like 200x. Closes: #475149
authorJoey Hess <joey@kodama.kitenet.net>
Tue, 9 Sep 2008 19:20:06 +0000 (15:20 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Tue, 9 Sep 2008 19:20:06 +0000 (15:20 -0400)
IkiWiki/Plugin/img.pm
debian/changelog
doc/plugins/img.mdwn

index 66cc08530e685e8d10f6ae90646d7496a00401d2..7b89ab6730faed3693f2d0eb59afa38a5194e854 100644 (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";
index 8df8e9f9d449cd13025614b67c66058c0d15dbe0..dd0bed151e097d3725657e709c79b449edd2ba9a 100644 (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
 
index 898609a29e6edb692fafdb866fb2deae93dc35b4..6da80b7e79781d2636149a586c827a0b4ff190d9 100644 (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`