- return '<a href="'.
- IkiWiki::abs2rel($file, IkiWiki::dirname($params{destpage})).
- '"><img src="'.
- IkiWiki::abs2rel($imglink, IkiWiki::dirname($params{destpage})).
+ my ($fileurl, $imgurl);
+ if (! $params{preview}) {
+ $fileurl=urlto($file, $params{destpage});
+ $imgurl=urlto($imglink, $params{destpage});
+ }
+ else {
+ $fileurl="$config{url}/$file";
+ $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)."]]";
+ }
+
+ my $imgtag='<img src="'.$imgurl.