title: Symfony2 - Checking if an image type exists
body: <p>I've been following an earlier post to check if an asset exists, which works great when using specific filenames. </p>
  
  <p><a href="https://stackoverflow.com/questions/16898628/symfony2-and-twig-check-if-an-asset-exists?lq=1">Symfony2 and Twig - Check if an asset exists</a></p>
  
  <p>However instead of checking for a specific image filename, how do you check for an image type? (all files with the .jpg extension)</p>
  
  <p>Example: *.jpg (which doesn't work neither does .jpg)</p>
  
  <pre><code>{% if asset_exists('/images/*.jpg') %}
      &lt;div class="entry-thumbnail"&gt;
              &lt;img width="230" height="172" src="{{ asset(['images/', post.image]|join) }}" class="" alt=""/&gt;
      &lt;/div&gt;
  {% endif %}
  </code></pre>