Then check $test_content to see if there is an IMG tag present, and if so, get the index of that tag.
Then do the same for the /IMG tag.
Then do a substr using the location of those two tags to get the value that is between the tags.
I figured out how to do what I wanted. This is for using Twitter Cards using the text and image from the first post of a given thread.
I made two files in the /library/TwitterCard folder.
index.php - This checks for an image in the first post of a thread to see if there is an image (assumes only 1 image). It also adds an og;image tag for the image if it finds one (useful for facebook sharing).
public static function getHTML()
$imgString = func_get_arg(1);