-
Notifications
You must be signed in to change notification settings - Fork 1
/
fullcode.php
41 lines (41 loc) · 1.4 KB
/
fullcode.php
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
36
37
38
39
40
41
<?php
if(!$filtered){include('filter.php');}
echo '<h2>Your photos as HTML code:</h2>';
if($ids !== null){
if(strpos($ids,',')){
$query = 'select * from flickr.photos.info where '.
'photo_id in ('.$ids.')';
} else {
$query = 'select * from flickr.photos.info where '.
'photo_id ='.$ids;
}
$api = 'http://query.yahooapis.com/v1/public/yql?q='.
urlencode($query).'&format=json';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
$data = json_decode($output);
echo '<textarea class="full">';
if(sizeof($data->query->results->photo)>1){
foreach($data->query->results->photo as $p){
addphoto($p);
}
} else {
$p = $data->query->results->photo;
addphoto($p);
}
echo '</textarea>';
}
function addphoto($p){
$img = "<p>\n<a href=\"".$p->urls->url->content.
"\">\n<img src=\"http://static.flickr.com/".$p->server.
"/".$p->id."_".$p->secret.".jpg\" \nalt=\"".
$p->title." by ".$p->owner->realname."\">\n</a>\n</p>\n";
$extras = "<!-- \n by http://www.flickr.com/people/".$p->owner->username.
"\n (".$p->owner->realname.
")\n License: " .$licenses[$p->license]['name']."\n-->\n\n";
echo htmlentities($img.$extras);
}
?>