Skip to content


Source for "A User's Groups"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require_once("phpFlickr/phpFlickr.php");
// Create new phpFlickr object
$f = new phpFlickr("[API Key]");
$f->enableCache(
    "db",
    "mysql://[username]:[password]@[server]/[database]"
);
 
if (!empty($_POST['username'])) {
    $person = $f->people_findByUsername($_POST['username']);
    $groups = $f->people_getPublicGroups($person['id']);
    for ( $i = 0; $i < 10 && $i < count($groups); $i++ ) {
        echo "<h3><a href='http://www.flickr.com/groups/" . 
            $groups[$i]['nsid'] . "/'>" . $groups[$i]['name'] . "</a></h3>\n";
        $photos = $f->groups_pools_getPhotos($groups[$i]['nsid'], NULL, NULL, NULL, 6);
        foreach ((array)$photos['photo'] as $photo) {
            echo "<a href=http://www.flickr.com/photos/" . $photo['owner'] . 
                "/" . $photo['id'] .">";
            echo "<img border='0' alt='$photo[title]' src=" . 
                $f->buildPhotoURL($photo, "Square") . ">";
            echo "</a>";
        }
    }
}
 
echo "<h3>Enter a username to search for</h3>";
echo "<form method='post'>";
echo "    <input name='username'><br>";
echo "    <input type='submit' value='Display Photos'>";
echo "</form>";
 
?>

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.