andyhajime Posted November 19, 2010 Share Posted November 19, 2010 Hello all, I'm currently doing this Facebook connect module for my website. With the FBconnect, it creates a user profile on my mysql, which stores only the Facebook userid, the full name, and the thumbnail url of this user. Currently the code works well except for this 'image url checking'. this is my fb profile image url: http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs349.snc4/41540_772137439_5612219_q.jpg when I've added a 'XXX' at the back ( http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs349.snc4/41540_772137439_5612219_qXXX.jpg ). It returns a blank instead. On Facebook, some accounts are not genuine and they might the deleted sooner or later. So I'm trying to figure out a php script or functions which detect if the image is not the 'XXX' version. I've tried using getimagesize() or file_get_contents() but still won't work. any ideas? Link to comment https://forums.phpfreaks.com/topic/219158-checking-if-url-of-image-is-valid-or-exist/ Share on other sites More sharing options...
upp Posted November 19, 2010 Share Posted November 19, 2010 does getimagesize() return anything? if it returns a low value you could tell your script only to display the image if its over a certain value Link to comment https://forums.phpfreaks.com/topic/219158-checking-if-url-of-image-is-valid-or-exist/#findComment-1136544 Share on other sites More sharing options...
papaface Posted November 19, 2010 Share Posted November 19, 2010 Could try <?php $info = @getimagesize("http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs349.snc4/41540_772137439_5612219_q.jpg"); if (isset($info["mime"])) echo "yay it exists" . "<br />"; else echo "nope it doesnt exist" . "<br />"; $info = @getimagesize("http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs349.snc4/41540_772137439_5612219_qXXX.jpg"); if (isset($info["mime"])) echo "yay it exists" . "<br />"; else echo "nope it doesnt exist" . "<br />"; Link to comment https://forums.phpfreaks.com/topic/219158-checking-if-url-of-image-is-valid-or-exist/#findComment-1136602 Share on other sites More sharing options...
andyhajime Posted November 21, 2010 Author Share Posted November 21, 2010 Thanks Papaface, code works lovely. Link to comment https://forums.phpfreaks.com/topic/219158-checking-if-url-of-image-is-valid-or-exist/#findComment-1137588 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.