title: get category image outside of category template in Magento
body: <p>How can I get the current category image from outside of the category template (view.phtml)?
  for example if I wanted to get it from header.phtml or footer.phtml.</p>
  
  <p>I tried copying the code from view.phtml:</p>
  
  <pre><code>&lt;?php
  $_helper    = $this-&gt;helper('catalog/output');
  $_category  = $this-&gt;getCurrentCategory();
  $_imgHtml   = '';
  if ($_imgUrl = $_category-&gt;getImageUrl()) {
  $_imgHtml = '&lt;p class="category-image"&gt;&lt;img src="'.$_imgUrl.'" alt="'.$this-&gt;htmlEscape($_category-&gt;getName()).'" title="'.$this-&gt;htmlEscape($_category-&gt;getName()).'" /&gt;&lt;/p&gt;';
  $_imgHtml = $_helper-&gt;categoryAttribute($_category, $_imgHtml, 'image');
  }
  ?&gt;
  </code></pre>
  
  <p>but i get this error when reloading the page:
       Fatal error:  Call to a member function getImageUrl() on a non-object</p>