Posted By

MichaelM on 08/17/11


Tagged

image check


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

bennettstone


Check to see if a external image exists


 / Published in: PHP
 

Simple call imageExists('http://example.com/image.jpg'); true if it exists else false.

  1. function imageExists($url){
  2. $h = get_headers($url);
  3. return ($h[0] == "HTTP/1.1 404 Not Found")?false:true;
  4. }

Report this snippet  

You need to login to post a comment.