|
IMG bb code
| Author | |
| Description | Replaces [img]http:///....[/img] with a html img tag. Great for blogs. |
| Rating | (7 votes) |
PHP Code
function replaceImg($message) {
// Make image from [img]htp://.... [/img]
if (strpos($message, "[img]")){
$begImg = strpos($message, "[img]");
$endImg = strpos($message, "[/img]");
$img = substr($message, $begImg, $endImg-$begImg+6);
$link = substr($img, 5, $endImg - $begImg -5);
$htmlImg = "<img src=$link border='0'>";
$message = str_replace($img, $htmlImg, $message);
// searches for other [img]-nodes
$message = replaceImg($message);
}
return $message;
}
Comments
No comments posted yet.
|