try{
$src = imagecreatefromjpeg('https://graph.facebook.com/'.$jsonfriends["data"][$randf]["id"].'/picture');
} catch (Exception $z){
$src = imagecreatefromgif('https://graph.facebook.com/'.$jsonfriends["data"][$randf]["id"].'/picture');
}
In the above code, when the code in the 'try' block fails, the control is not passing to the 'catch' block. I'm getting output as error as https://graph.facebook.com/xxxxxx/picture is not a valid JPEG. Actually, if its not a JPEG, it would be GIF in this context. So can anyone help me regarding this?