title: Wordpress Featured Image as a background
body: <p>I am trying to echo out the featured image of a post as a background image. I have seen a few places this should be possible but i cant seem to make it work for my self. </p>
  
  <pre><code>//Here i get the image as a thumbnail 
   &lt;?php 
   if ( has_post_thumbnail()) {
     $image = the_post_thumbnail('thumbnail');
   }
   ?&gt;
       // Here i try to get it as a background image and nothing 
  &lt;div style="width:405px;height:277px;background-image:url('&lt;?php echo $image; ?&gt;');"&gt;
      &lt;img src="&lt;?php bloginfo('template_url'); ?&gt;/images/foreground.png"/&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>But if i use this i can echo out the thumbnail</p>
  
  <pre><code>&lt;?php echo '&lt;img src="' . $image . '"/&gt;'; ?&gt;
  </code></pre>
  
  <p>I feel like i am missing something small and stupid but what is it?</p>