loadXml($xml); $xpath = new domxpath($dom); $nodes = $xpath->query('//entry'); foreach ($nodes as $node) { $tmp[]['src'] = $xpath->query('.//media:thumbnail/@url', $node)->item(0)->textContent; } return $tmp; } //THIS IS BASED ON http://blogoscoped.com/archive/2007-03-22-n84.html function getAlbums($userId) { $url = 'http://picasaweb.google.com/data/feed/api/user/' . urlencode($userId) . '?kind=album'; $xml = curlit($url); $xml = str_replace("xmlns='http://www.w3.org/2005/Atom'", '', $xml); $dom = new domdocument; $dom->loadXml($xml); $xpath = new domxpath($dom); $nodes = $xpath->query('//entry'); foreach ($nodes as $node) { $tmp[] = $xpath->query('title', $node)->item(0)->textContent; } return $tmp; } //set the google user id. my pics are nice, but this should be yours. $userid = 'myles.henderson'; //get the list of albums $albums = getAlbums($userid); //get a random album $album_title = $albums[array_rand($albums, 1)]; //google wants only the letters and numbers in the url $album_title = ereg_replace("[^A-Za-z0-9]", "", $album_title); //get the list of pictures from the album $pictures = showAlbumContent($userid, $album_title); //get a random picture from the album if(is_array($pictures)){ $random_pic = $pictures[array_rand($pictures,1)]['src']; print ''; } else{ print 'no pictures for album ' . $album_title; } ?>