Skip to content

Instantly share code, notes, and snippets.

@mimeoconnect
Created February 12, 2011 04:53
Show Gist options
  • Select an option

  • Save mimeoconnect/823530 to your computer and use it in GitHub Desktop.

Select an option

Save mimeoconnect/823530 to your computer and use it in GitHub Desktop.
<?php
// include auto-loader class
require_once 'Zend/Loader/Autoloader.php';
// define API key
$API_Key = '[Flickr API Key]';
// register auto-loader
$loader = Zend_Loader_Autoloader::getInstance();
// initialize client with data set
$client = new Zend_Rest_Client('http://api.flickr.com/services/rest/');
// set method name and API key
$client->method('flickr.photos.search');
$client->api_key($API_Key);
// set method arguments
$client->user_id('66449089@N00');
// set method arguments
$client->tags("instagram app");
$client->per_page(4);
// Pull Request
$result = $client->get();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Displaying Flickr Images as Polaroid Album</title>
<style type="text/css">
body{
background-color: #000;
}
#container{
width: 600px; margin: 40px auto;
}
ul.gallery {
list-style: none;
}
ul.gallery li a {
position: relative;
float: left;
padding: 10px 10px 25px 10px;
background: #FFF;
border: 1px solid #fff;
-moz-box-shadow: 0px 2px 15px #333;
}
ul.gallery li a.pic-1 {
z-index: 1;
-webkit-transform: rotate(-10deg);
-moz-transform: rotate(-10deg);
}
ul.gallery li a.pic-2 {
z-index: 5;
-webkit-transform: rotate(-3deg);
-moz-transform: rotate(-3deg);
}
ul.gallery li a.pic-3 {
z-index: 3;
-webkit-transform: rotate(4deg);
-moz-transform: rotate(4deg);
}
ul.gallery li a.pic-4 {
z-index: 4;
-webkit-transform: rotate(14deg);
-moz-transform: rotate(14deg);
}
ul.gallery li a:hover {
z-index: 10;
-moz-box-shadow: 3px 5px 15px #333;
}
ul {
display: inline;
}
li {
float: left;
list-style-type: none;
padding: 10px;
font-size: smaller;
text-align: center;
height: 250px;
width: 250px;
}
li img {
border: solid 2px black;
padding: 4px;
}
</style>
</head>
<body>
<div id="container">
<ul class="gallery">
<?php
$i = 1;
foreach ($result->photos->photo as $photo)
{
$photoUrl = sprintf('http://farm%s.static.flickr.com/%s/%s_%s_m.jpg', $photo['farm'], $photo['server'], $photo['id'], $photo['secret']);
$pageUrl = sprintf('http://www.flickr.com/photos/%s/%s', $photo['owner'], $photo['id']); ;
?>
<li><a href="#" class="pic-<?php echo $i;?>"><img src="<?php echo $photoUrl; ?>" alt="" /></a></li>
<?php
$i++;
}
?>
</ul>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment