title: How to find if an image exists, or renders ok issue in PHP?
body: <p>I have this situation where I have some pictures:</p>
  
  <pre><code>http://www.example.com/test1.jpg
  http://www.example.com/test2.jpg
  http://www.example.com/test3.jpg
  ....
  </code></pre>
  
  <p>some of them might be dead links and the image will not show up, but a small <code>broken</code> icon.</p>
  
  <p>I am doing this to check for those images:</p>
  
  <pre><code>if(!is_array(getimagesize($mediapath))){
    $mediapath = '';
  } 
  return $mediapath;
  </code></pre>
  
  <p>Basically <code>getimagesize</code> gets the image size of a image :), and returns an array. If the image is broken it errors out.</p>
  
  <p>And this is my problem. The code does the job ok, but now I get error telling me that some files don't exist:</p>
  
  <pre><code>Warning: getimagesize(http://www.example.com/test2.jpg) [function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\xampp\htdocs\zend\models\mappers\search.php on line 173
  </code></pre>
  
  <p>But this is the desired result, I just dont want those errors on the page, And no, I don't want to disable errors in PHP, I want the 'getimagesize' method not to show that error.</p>