i have a slight problem i am making a forum and want the user not to be able to input html code. they can make an image by typing

they can make by just typing:
http://www.url.com
i use the code:
$text = eregi_replace("((http|mailto|ftp):\/\/[[:space:]<>]{1,})", "<a href=\"\1\">\1</a>",$text);
i want to know how to check to see if there is an [img] tag before the url so that the image doesn't get all screwed up?