Checking if a post contains an html tag

You could try something like this if you are checking the content in the main loop.

$content = get_the_content();
preg_match_all('/(<img .*?>)/', $content, $img_tags);

if (!empty($img_tags)) {
    // Post content contains images, do something!
}

// Check for links and do something if you have matches