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
34
35
| <?php
require_once("phpFlickr/phpFlickr.php");
// Create new phpFlickr object
$f = new phpFlickr("[API Key]","[API Secret]");
$f->enableCache(
"db",
"mysql://[username]:[password]@[server]/[database]"
);
$f->auth();
$token = $f->auth_checkToken();
// Find the NSID of the authenticated user
$nsid = $token['user']['nsid'];
// Get the friendly URL of the user's photos
$photos_url = $f->urls_getUserPhotos($nsid);
// Get the user's first 36 public photos
$photos = $f->photos_search(array("user_id" => $nsid, "per_page" => 36));
// Loop through the photos and output the html
foreach ((array)$photos['photo'] as $photo) {
echo "<a href=$photos_url$photo[id]>";
echo "<img border='0' alt='$photo[title]' ".
"src=" . $f->buildPhotoURL($photo, "Square") . ">";
echo "</a>";
$i++;
// If it reaches the sixth photo, insert a line break
if ($i % 6 == 0) {
echo "<br>\n";
}
}
?> |
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.