Jump to content

Checking if URL of image is valid or exist.


andyhajime

Recommended Posts

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?

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 />";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.