Image game
We were playing games last night and I was reminded of a Swedish TV game show where each team of contestants was shown five images and had to come up with a song that related to three of the images.
So we came up with the idea to do that at home with a laptop and randomized images from the web. So I made a page that does that!
It simply fetches five images from the flickr’s random “interesting photos from the last 7 days” using this function (derived from this post):
<?php
$doc = new DOMDocument();
@$doc->loadHTMLFile("http://www.flickr.com/explore/interesting/7days/");
$xpath = new DOMXpath($doc);
if($xpath){
$src = $xpath->query("//td[@class='Photo']/span/a/img/@src");
$url = $xpath->query("//td[@class='Photo']/span/a/@href");
print '<a href="http://www.flickr.com'.$url->item(0)->nodeValue.'">
<img src="'.$src->item(0)->nodeValue.'" /></a>';
print '<a href="http://www.flickr.com'.$url->item(1)->nodeValue.'">
<img src="'.$src->item(1)->nodeValue.'" /></a>';
print '<a href="http://www.flickr.com'.$url->item(2)->nodeValue.'">
<img src="'.$src->item(2)->nodeValue.'" /></a>';
print '<br />';
print '<a href="http://www.flickr.com'.$url->item(3)->nodeValue.'">
<img src="'.$src->item(3)->nodeValue.'" /></a>';
print '<a href="http://www.flickr.com'.$url->item(4)->nodeValue.'">
<img src="'.$src->item(4)->nodeValue.'" /></a>';
}
?>
Ideas - Johan @ 14:52 |

