Get PID from FBID

<?php
include("lib/facebook.php");
$APPLICATION_ID = "xxxxxxxxxxxxxxx";
$APPLICATION_SECRET = "yyyyyyyyyyyyyyyyyyyyyyyyyyyy";
$facebook = new Facebook(array(
'appId'  => $APPLICATION_ID,
'secret' => $APPLICATION_SECRET,
'cookie' => true
));
$fbid="xxxxxxxxxx";
$fql = "SELECT pid FROM photo WHERE object_id=".$fbid;
$param  =   array(
 'method'    => 'fql.query',
 'query'     => $fql,
 'callback'  => ''
);
$fqlResult   =   $facebook->api($param);
$fql = "SELECT src_small, src_big  FROM photo WHERE pid = '".$fqlResult[0]['pid']."' ";
$param  =   array(
 'method'    => 'fql.query',
 'query'     => $fql,
 'callback'  => ''
);
$fqlResult   =   $facebook->api($param);
echo $fqlResult[0]['src_big'];
print_r(getimagesize($fqlResult[0]['src_big']));
echo "http://www.facebook.com/photo.php?fbid='".$fbid."' ";
?>

Life is the art of drawing without an eraser.So be careful while taking any small decisions about the valuable pages of life.