/ Published in: PHP
Expand |
Embed | Plain Text
<?php $flickrId = 'userId'; // Find your Flickr ID at http://idgettr.com $flickrrequest = 'http://api.flickr.com/services/feeds/photos_public.gne?id=' . $flickrId . '&format=json'; $flickrci = curl_init($flickrrequest); curl_setopt($flickrci,CURLOPT_RETURNTRANSFER, TRUE); $flickrinput = curl_exec($flickrci); curl_close($flickrci); // Flickr JSON doesn't come in standard form, some str replace needed // parameter 'true' is necessary for output as PHP array $flickrvalue = json_decode($flickrinput,true); $flickritem = $flickrvalue['items']; // echo the channel information $photosToDisplay = 5; //change this to the number of photos you want to display for($p=0;$p<$photosToDisplay;$p++){ echo "<a href=\"" . $flickritem[$p]['link'] . "\"><img src=\"" . $flickritem[$p]['media']['m'] . "\" /></a>\n"; } ?>
You need to login to post a comment.
