phat code Today is the yesterday you worried about tomorrow.
Main

Projects

Downloads

Articles

Links

Forum

 

View Message

Back to Messages
Plasma Thu Jul 21 2022 at 5:28 am
<img> is 5 characters
 
 
So you need to use something like this:

elseif ((strtolower(substr($text, $offset, 5)) == '<img>') && (TAG_IMG_ENABLED))
{
    $text = substr_replace($text, '<img src="', $offset, 5);
    $offset += 9;
}
elseif ((strtolower(substr($text, $offset, 6)) == '</img>') && (TAG_IMG_ENABLED))
{
    $text = substr_replace($text, '">', $offset, 6);
    $offset++;
}

You will need additional changes to prevent the forum from replacing the image URL with a link (similar to $in_code). Also would be good to check for things like recursive img tags.
 
 
 
 

Reply to this Message

Name
Subject
Message

No HTML is allowed, except for <code> <b> <i> <u> in the message only.
All URLs and email addresses will automatically be converted to hyperlinks.