This PHP code will check if the featured image on post or page contains an image and will display as image url on your theme template
It works on a loop, single and page php template
<img src="'.(has_post_thumbnail( $post->ID ) ? ''.wp_get_attachment_url( get_post_thumbnail_id($post->ID) ).'' : 'replace this to a image url path').'">