title: imagecreatefrompng error - how to detect and handle?
body: <p>In my script, I have the following lines: </p>
  
  <pre><code>$test = @imagecreatefrompng($name);
  if ($test) { ... }
  </code></pre>
  
  <p>I am certain that <code>$name</code> represents an existing file on the disk, but I must handle cases where that file is not a valid PNG file (either because of a transfer error or because of a malicious user). I wish to handle such cases by not doing anything at all. </p>
  
  <p>However, given the above code, my PHP interpreter stops on the first line with the following error message:</p>
  
  <blockquote>
    <p>imagecreatefrompng() [function.imagecreatefrompng]: 'foobar.png' is not a valid PNG file</p>
  </blockquote>
  
  <p>Shouldn't '<code>@</code>' have suppressed this error message and had the function return <code>false</code>as described in the documentation? How can I tell PHP that I know an error might happen and <em>not</em> interrupt the execution?</p>