If anyone has the experience, how could I obtain the image extension, and if it's swf to do something else? Remote image, and I'm using php4. One more thing, the link is stored in a database. if I'll do a preg match, there will be a risk, that the image to contain 2 or more times 2 different words, giving an error. example(doesn't work) h ttp://upload.wikimedia.org/imagif/page.swf
In case anyone else is wondering or you want something succinct. You can use the pathinfo function to accomplish this.
//$pimp[8] is the query $pro=strrchr($pimp[8],'.'); if($pro == ".swf") { //flash } else{//image } PHP:
Or just create a function: function get_file_extension($file) { $ext = explode(".", $file); $extcount = count($ext); return strtolower($ext[$extcount - 1]); } PHP: $file = "name.swf"; $extension = get_file_extension($file); if ( $extension == "swf" ) { // Extension is SWF so execute code } PHP: