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]"
);
// Get photo data
$photo_id = "34952612";
$p = $f->photos_getInfo($photo_id);
echo "<div style='text-align: center'><img style='width: 480px;' src='http://static.flickr.com/{$p['server']}/{$p['id']}_{$p['secret']}.jpg' alt='{$p['title']}' /></div>";
echo "<h2>Comments on this photo:</h2>";
// Get a list of comments for the given photo, loop through and display them.
$comments = $f->photos_comments_getList($photo_id);
foreach ((array)$comments['comments']['comment'] as $c) {
$author = $f->people_getInfo($c['author']);
if ($author['iconserver'] > 0) $icon = "http://static.flickr.com/{$author['iconserver']}/buddyicons/{$author['id']}.jpg";
else $icon = "http://www.flickr.com/images/buddyicon.jpg";
echo "<div style='margin-bottom: 20px; clear: both;'>";
echo "<div style='margin-bottom: 20px; float: left'><img alt='{$author['username']}' src='{$icon}' /></div>";
echo "<div>";
echo "<div style='font-weight: bold; font-size: 10pt;'><a style='display: inline; font-weight: bold; font-size: 10pt;' href='{$author['photosurl']}'>{$author['username']}</a> says:</b></div>";
echo str_replace("\n", "</p><p>", "<div>{$c['_content']}</div>");
echo "</div>";
echo "</div>";
}
?> |
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.