title: Symfony2 - Checking if a file exists in Twig
body: <p>Is there a way to check if the file exists in Twig for an image uploaded in a newly created post? </p>
  
  <p>The way I have my post setup is if an image is not uploaded the Twig template will show an empty box with the proportions of where the image should be, but it's a blank box that's awkward to look at.</p>
  
  <p>Question, is if there is a specific command to use with an if statement to check if a file exists if so, display the image code if not do not display the image code.</p>
  
  <p><strong>Image code: (this is the code I want to hide if no image exists to get rid of the empty box)</strong></p>
  
  <pre><code>&lt;div class="entry-thumbnail"&gt;
      &lt;img width="230" height="172" src="{{ asset(['images/', post.image]|join) }}" class="" alt=""/&gt;
  &lt;/div&gt;
  </code></pre>