note 20231 deleted from ref.image by victor

From: Date: Mon, 09 Dec 2002 18:36:32 +0000
Subject: note 20231 deleted from ref.image by victor
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-40588@lists.php.net to get a copy of this message
He's a function to find whether a file is an image: function is_image($file){ $fp = fopen($file, "r"); $fcont = fread($fp, 15); fclose($fp); if(strstr($fcont,"PNG")){ $imagetype = "image/png"; }elseif(strstr($fcont,"GIF")){ $imagetype = "image/gif"; }elseif(strstr($fcont,"JFIF")){ $imagetype = "image/pjpeg"; }elseif(strstr($fcont,"BM")){ $imagetype = "image/bmp"; } if(isset($imagetype)){ return $true; }else{ return $false; } } Enjoy! :)

« previous php.notes (#40588) next »