There are many ways t extract an image from a post with WordPress. Many magazine themes use this functionality to get a thumbnail displayed on their homepage for instance. Wpengineer gives us a good tutorial to explain you the different ways to achieve such result.
Did you know about the conditional tag, is_singular()? The is_singular() tag enables you to target single-view pages, regular page pages, and attachment pages all in one fell swoop. Here is a quick tutorial to explain you the difference and how to use them.