<slide title="" body_style="background: #dce4e4; font-family: Georgia, Times, serif; overflow: hidden;">

<example hide="1" result="1" outputbackground="#dce4e4" fontsize="1.4em"><![CDATA[
<style>
#pile {
  width: 800px;
  height: 600px;
  margin: 10px auto;
  padding: 20px;
  position: relative;
}
#pile div {
  background: #fff;
  position: absolute;
  overflow: hidden;
  opacity: 0.9;
  -webkit-transition: all 1500ms linear;

  -webkit-border-radius: 15px;
  -moz-border-radius: 15px;
  border-radius: 15px;

  -webkit-box-shadow: -3px -3px 30px #666;
  -moz-box-shadow: -3px -3px 30px #666;
  box-shadow: -3px -3px 30px #666;
}
#pile img {
  -webkit-mask-box-image: url(/images/background.svg);
  -webkit-mask-repeat: none;
}
<?php for($i=0; $i<50; $i++):
    $rot = rand(-30,30);
    $top = rand(-20,475);
    $left = rand(-100,720);
    $z = rand(1,15);
    echo <<<EOB
#pile #img{$i} {
  -webkit-transform: rotate({$rot}deg);
  -moz-transform: rotate({$rot}deg);
  top: {$top}px;
  left: {$left}px;
  z-index: {$z};
}
#pile div#img{$i}:hover { 
  -webkit-transform: rotate(0deg); 
  -moz-transform: rotate(0deg); 
  z-index: 999; 
  opacity: 1;
}

EOB;
endfor; ?>
</style>
<?php
if(!isset($_REQUEST['loc'])) $loc = ':-:location:-:';
else $loc = htmlspecialchars($_REQUEST['loc'], ENT_QUOTES, "UTF-8");
?>
<form style="width:100%; text-align:center;" action="<?php echo htmlspecialchars($PHP_SELF)?>" method="POST">
<input type=text name=loc autocomplete="off" style="display: inline-block; text-align: center; background:transparent; border:0; font-size:36px;" value="<?php echo $loc?>" size=20 maxlength=60>
</form>
<div id="pile">
<?php
include 'presentations/slides/intro/yql.php';
$q = <<<EOQ
select * from flickr.photos.search(100) where tags="$loc" 
         and sort="interestingness-desc"
         and api_key="{$secrets['api_key']}"
EOQ;
$i=0;
$x = yql($q);
foreach($x->results->photo as $p) {
    if($i++ > 50) break;
    $url = furl($p, 'm');
    $rot = rand(-30,30);
    $style = "-webkit-transform: rotate({$rot}deg); -moz-transform: rotate({$rot}deg);";
    $top = rand(50,500);
    $left = rand(-50,710);
    $style .= "top: {$top}px; left: {$left}px;";
    $z = rand(1,15);
    $style .= "z-index: {$z};";
    $t = htmlspecialchars($p['title'], ENT_QUOTES, 'utf-8');
echo <<<EOI
    <div id="img{$i}">
      <img src="{$url}" title="$t" style="display:none" onload="this.style.display='block'" />
    </div>

EOI;
}
?>
</div>
]]></example>

</slide>
