Revision [106]
This is an old revision of Mod019fInlineImages made by JsnX on 2004-04-04 05:46:08.
Wikka Mod 019
Type: Feature additionCredit:
Adrian Lookhttp://www.wakkawiki.com/InlineImages
Inline Images
A simple alternative to ImgAction would be to modify URL matching in formatters/wakka.php. This converts gif, jpg, and png URLs into <img> tags rather than <a> tags. Of course, if you want to force a link, instead of an inline image, just use [[ ]] as usual.
Add one line to formatters/wakka.php so that instead of:
<?php
// urls
else if (preg_match("/^([a-z]+:\/\/\S+?)([^[:alnum:]^\/])?$/", $thing, $matches)) {
$url = $matches[1];
return "<a href=\"$url\">$url</a>".$matches[2];
}
?>
// urls
else if (preg_match("/^([a-z]+:\/\/\S+?)([^[:alnum:]^\/])?$/", $thing, $matches)) {
$url = $matches[1];
return "<a href=\"$url\">$url</a>".$matches[2];
}
?>
it now reads:
<?php
// urls
else if (preg_match("/^([a-z]+:\/\/\S+?)([^[:alnum:]^\/])?$/", $thing, $matches)) {
$url = $matches[1];
if (preg_match("/^(.*)\.(gif|jpg|png)/si", $url)) return "<img src=\"$url\" />".$matches[2];
return "<a href=\"$url\">$url</a>".$matches[2];
}
?>
// urls
else if (preg_match("/^([a-z]+:\/\/\S+?)([^[:alnum:]^\/])?$/", $thing, $matches)) {
$url = $matches[1];
if (preg_match("/^(.*)\.(gif|jpg|png)/si", $url)) return "<img src=\"$url\" />".$matches[2];
return "<a href=\"$url\">$url</a>".$matches[2];
}
?>
Of course, ImgAction is still useful for cool stuff like alt tags, sizes, links, etc