There’s more 3D goodness for you to enjoy now that the Mapping our Anzacs scrapbook is Cooliris-enabled. If you have Cooliris installed, you’ll notice that the Cooliris icon on your browser toolbar lights up when you visit the site. Just click on the icon to browse all the photos posted to the scrapbook on a glorious 3D wall.
(If you don’t have Cooliris then go and get it. It can be used both in Internet Explorer and Firefox, though you’ll probably need to have admin rights to install for IE.)
Having given the 3D treatment to digitised files from the National Archives of Australia and portrait images from the Australian Dictionary of Biography, it wasn’t too hard to do. The scrapbook is a Tumblr site and the api makes it easy to extract all the photos. So I created a php file to gather all the details and then write them to a media-rss file. Then it was just a matter of inserting a link to it in the scrapbook.
Code follows:
</p>
<p><?php<br />
if ($_GET['start']) {<br />
$start = $_GET['start'];<br />
} else {<br />
$start = 0;<br />
}<br />
$url = "http://our-anzacs.tumblr.com/api/read?start=$start&num=50&type=photo&filter=text";<br />
$ch = curl_init();<br />
curl_setopt($ch, CURLOPT_URL, $url);<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);<br />
curl_setopt($ch, CURLOPT_FAILONERROR, true);<br />
curl_setopt($ch, CURLOPT_TIMEOUT, 20);<br />
$result = curl_exec($ch);<br />
if (!$result) {<br />
echo "cURL error number:" .curl_errno($ch);<br />
echo "cURL error:" . curl_error($ch);<br />
exit;<br />
}<br />
curl_close($ch);<br />
$dom = new DOMDocument();<br />
@$dom->loadHTML($result);<br />
$xpath = new DOMXPath($dom);<br />
$attrs = $xpath->evaluate("//posts/@total[1]");<br />
foreach ($attrs as $attr) {<br />
$total = $attr->nodeValue;<br />
}<br />
$num_pages = ceil($total/50);<br />
$start_next = $start+50;<br />
$start_previous = $start-50;</p>
<p>echo "<?xml version='1.0' encoding='utf-8' standalone='yes'?>n";<br />
echo "<rss version='2.0' xmlns:media='http://search.yahoo.com/mrss/' xmlns:atom='http://www.w3.org/2005/Atom'>n";<br />
echo "<channel>n";<br />
echo "n";<br />
echo "<description>Photos posted to the Mapping our Anzacs scrapbook</description>n";<br />
echo "
<link>http://our-anzacs.tumblr.com</link>n";<br />
if ($start_previous >= 0) {<br />
echo "<atom:link rel='previous' href='moa-media-rss.php?start=$start_previous' />";<br />
}<br />
if ($start_next <= $total) {<br />
echo "<atom:link rel='next' href='moa-media-rss.php?start=$start_next' />";<br />
}<br />
$posts = $xpath->evaluate("//post/@id");<br />
foreach ($posts as $post) {<br />
$id = $post->nodeValue;<br />
$url = "http://our-anzacs.tumblr.com/post/$id";<br />
$photos = $xpath->evaluate("//post[@id='$id']/photo-url[@max-width='500']/text()");<br />
foreach ($photos as $photo) {<br />
$photo_500 = $photo->nodeValue;<br />
}<br />
$photos = $xpath->evaluate("//post[@id='$id']/photo-url[@max-width='250']/text()");<br />
foreach ($photos as $photo) {<br />
$photo_250 = $photo->nodeValue;<br />
}<br />
$nodes = $xpath->evaluate("//post[@id='$id']/photo-caption/text()");<br />
foreach ($nodes as $node) {<br />
$caption = $node->nodeValue;<br />
preg_match("/View details fors+([ws,-]*)/", $caption, $matches);<br />
$names = explode(", ", $matches[1]);<br />
$name = "$names[1] $names[0]";<br />
}<br />
echo "<item>n";<br />
echo "<guid isPermaLink='false'>$id</guid>n";<br />
echo "n";<br />
echo "
<link>$url</link>n";<br />
echo "<media:thumbnail url='$photo_250' />n";<br />
echo "<media:content url='$photo_500' type='image/jpeg' />n";<br />
echo "</item>n";<br />
}<br />
echo "</channel>n";<br />
echo "</rss>n";<br />
?></p>
<p>

Comments 1
just installed Greasemonkey, your script and then Cooliris…OMG…what a way to browse images…certainly brings the archives to life not to mention the photos of the kids from the desktop! thanks heaps Tim.
Now I’m trying to work out if I can cut and paste an url such as http://proarchives.imagineering.com.au/index_search_results.asp into the cooliris url so that i can browse images off specific sites?
Cheers, asa
Posted 12 Mar 2010 at 9:45 pm ¶Post a Comment