If you're in Loop , the post ID is known by WP, so just use the function get_post_thumbnail_id()
without parameter. >
If you're out of Loop , it's a matter of using get_post_thumbnail_id($post_id)
.
And with this information at hand, use the wp_get_attachment_image_src
function that indicates the Leandro .
Example:
$img = wp_get_attachment_image_src( get_post_thumbnail_id() );
echo "<img src='$img[0]' />";
How It Works : The the_post_thumbnail
function is a simple encapsulation for the get_the_post_thumbnail
function, which in turn ends by calling the wp_get_attachment_image
function.