aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-05-23 01:44:11 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-05-23 01:44:11 +0000
commitbb0cbecbc377c3966f177b210fcfabe487d0452c (patch)
treeb50f849cd7f6dcf6a5001f03acacc747201eabb4 /IkiWiki
parent4550b6258bf759f28a10eeb82d36c659330376c1 (diff)
downloadikiwiki-bb0cbecbc377c3966f177b210fcfabe487d0452c.tar
ikiwiki-bb0cbecbc377c3966f177b210fcfabe487d0452c.tar.gz
* Correct bug in the img plugin that caused dependencies on images to not
always be tracked correctly.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/img.pm18
1 files changed, 15 insertions, 3 deletions
diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm
index 7226231a0..7e167240e 100644
--- a/IkiWiki/Plugin/img.pm
+++ b/IkiWiki/Plugin/img.pm
@@ -31,9 +31,17 @@ sub preprocess (@) { #{{{
return '';
}
- add_depends($params{page}, $image);
- my $file = bestlink($params{page}, $image)
- || return "[[img ".sprintf(gettext("%s not found"), $image)."]]";
+ my $file = bestlink($params{page}, $image);
+ if (! $file) {
+ # TODO: this may not be right, depending on where the file is
+ # created in the end
+ add_depends($params{page}, $image);
+
+ return "[[img ".sprintf(gettext("%s not found"), $image)."]]";
+ }
+ else {
+ add_depends($params{page}, $file);
+ }
my $dir = IkiWiki::dirname($file);
my $base = IkiWiki::basename($file);
@@ -93,6 +101,10 @@ sub preprocess (@) { #{{{
$imgurl="$config{url}/$imglink";
}
+ if (! defined($im->Get("width")) || ! defined($im->Get("height"))) {
+ return "[[img ".sprintf(gettext("failed to determine size of image %s"), $file)."]]";
+ }
+
return '<a href="'.$fileurl.'"><img src="'.$imgurl.
'" alt="'.$alt.'" width="'.$im->Get("width").
'" height="'.$im->Get("height").'" /></a>';