Upload Image Links
Short description
You'll be able to write links as [http://foo.bar.com upload:myPic.jpg] and [MyWiki:InterWikiSite upload:myOtherPic.jpg], which I found desirable. That way not only Wiki-own Sites can be image links.
How to apply
In sub StoreBracketInterPage on line 1863:
if ($BracketImg && $useImage && &ImageAllowed($text)) {
replace the rest of the sub with this:
if ( $text =~ /$UploadPattern/ ) {
$text = '<img src="' . $UploadUrl. '/' . &GetUploadURL($1) . '">';
}
else {
$text = "<img src=\"$text\">";
}
} else {
$text = "[$text]";
}
return &StoreRaw("<a href=\"$url\">$text</a>");
}
In sub ImageAllowed on line 1964:
$imagePrefixes = 'http:|https:|ftp:';
would be:
$imagePrefixes = 'http:|https:|ftp:|upload:';
In sub StoreBracketUrl on line 1982:
if ($BracketImg && $useImage && &ImageAllowed($text)) {
replace the rest of the sub with this:
if ( $text =~ /$UploadPattern/ ) {
$text = '<img src="' . $UploadUrl. '/' . &GetUploadURL($1) . '">';
}
else {
$text = "<img src=\"$text\">";
}
}
else {
$text = "[$text]";
}
return &StoreRaw("<a href=\"$url\">$text</a>");
}
Then put somewhere, where it makes sense to you the little sub:
sub GetUploadURL {
my ($url) = @_;
return &StoreRaw($url);
}
Hope this helps anyone, --
UdoGüngerich, 2005-08-22