A while ago now I wrote a very simple Facebook application to show a random photo from one of your friends. It was the facebook app I built and was really only to play around with their framework.
I received a response from a guy called me Jeff asking about showing photos in facebook and the photo tag. Well, Jeff, here’s the code. As you’ll see, there’s nothing to it! I’m not sure if this will help but feel free to post a comment (or anyone else) and I’ll do my best to answer.
<?php
// the facebook client library
include_once 'fbclient/facebook.php';
// this defines some of your basic setup
include_once 'config.php';
$facebook = new Facebook($api_key, $secret);
$facebook->require_frame();
$user = $facebook->require_login();
$facebook->require_install();
$friendsPics = $facebook->api_client->fql_query("SELECT link
FROM photo
WHERE aid IN (SELECT aid FROM album WHERE owner IN (SELECT
uid2 FROM friend WHERE uid1=$user))"); $friendsPicCount = count($friendsPics); srand(time()); $randomPicID = (rand()%$friendsPicCount); $thepic = $friendsPics[$randomPicID]; echo "<fb:redirect url=\"$thepic[link]\"></fb:redirect>" ?>