PhpSnip.com

User Stats

spidermanuk

tests to see if an image file (jpg/gif..) exists and if it does not then it can display alternative text! Good to use if your website in underconstrucion and you are waiting for someone else to add images as they get them. No more explorer missing image icons!

Info

 Download  View Source (print view)
 Rating : 4.7  Views : 342

Source Code ( 16 lines )

function doiexist($path, $findfile) 
{
// Source = www.spiderandjenni.com/phptips
$found=0;
if ($dir = @opendir($path)) {
			    while (($file = readdir($dir)) !== false) {
  								      if($file==$findfile){$found=1;}
			}  
  			    closedir($dir);
			    }else{print "no such dir path"; $found==2;}

return($found);

} 

?>

Search

Subscribe

  Rss Feeds

Sponsors

Advertise