cooldude832 Posted January 3, 2008 Share Posted January 3, 2008 I want to make an is_img fucntion to verify a remote url is an image file, I think the best way is retrive the doucment and read the binaries for png, jpg, gif headers any ideas? Link to comment https://forums.phpfreaks.com/topic/84242-solved-is_img-function/ Share on other sites More sharing options...
trq Posted January 3, 2008 Share Posted January 3, 2008 <?php function is_image($path) { if (is_array(getimagesize($path)) { return true; } return false; } ?> Link to comment https://forums.phpfreaks.com/topic/84242-solved-is_img-function/#findComment-429051 Share on other sites More sharing options...
jitesh Posted January 3, 2008 Share Posted January 3, 2008 Check mime content type for a file. string mime_content_type ( string filename ) Link to comment https://forums.phpfreaks.com/topic/84242-solved-is_img-function/#findComment-429062 Share on other sites More sharing options...
cooldude832 Posted January 3, 2008 Author Share Posted January 3, 2008 its an external file so mime won't work i think thrope's idea will work Link to comment https://forums.phpfreaks.com/topic/84242-solved-is_img-function/#findComment-429588 Share on other sites More sharing options...
cooldude832 Posted January 3, 2008 Author Share Posted January 3, 2008 thrope it worked less the ) you missed;) <?php function is_image($path){ if(is_array(getimagesize($path))){ return true; } return false; } ?> Link to comment https://forums.phpfreaks.com/topic/84242-solved-is_img-function/#findComment-429595 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.