// get photo ID $id = isset($_GET['photoid']) ? $_GET['photoid'] : NULL; $query = isset($_GET['query']) ? $_GET['query'] : NULL; $page = isset($_GET['page']) ? $_GET['page'] : NULL; // get photo's information details $photo = $Flickr->getInfo($id, $secret = NULL); $photo = $photo['photo']; //print_r($photo); //get photo context info $context = $Flickr->getContext($id); //print_r($context); $prev_photo = $context['prevphoto']; $prev_photo_id = $prev_photo['id']; $next_photo = $context['nextphoto']; $next_photo_id = $next_photo['id']; $photoUrl = $Flickr->getPhotoURL($photo, $size = "large"); //print_r($photoUrl); echo "<div class='photo_content'>"; echo "<img src='{$photoUrl}' alt=" . $photo["title"]["_content"] . " />"; echo "<p>Title: " . $photo["title"]["_content"] . "</p>"; echo "<p>Description: " . $photo["description"]["_content"] . "</p>"; echo "<p>User: "******"owner"]["username"] . "</p>"; echo "<p>Location: " . $photo["owner"]["location"] . "</p>"; echo "<br>"; echo "<div class='pagination_footer'><div>"; if (isset($prev_photo_id)) { echo "<div id='prev_page' class='pagination left'><a href='?photoid={$prev_photo_id}&page={$page}&query={$query}'><img src=\"" . $prev_photo['thumb'] . "\" />« Prev photo </a></div>"; } if (isset($next_photo_id)) { echo "<div id='prev_page' class='pagination left'><a href='?photoid={$next_photo_id}&page={$page}&query={$query}'>Next photo »<img src=\"" . $next_photo['thumb'] . "\" /></a></div>"; }
$back = $page - 1; $next = $page + 1; if (!empty($tags)) { //load search returned result page $res = $Flickr->search($tags, $page, '5'); } else { //load default page with recent uploaded images $res = $Flickr->getRecent(NULL, $page); } //print_r($res); // returns total number of pages $pages = $res['photos']['pages']; echo "<div class='image_group_wrapper'>"; foreach ($res['photos']['photo'] as $photo) { //prepare image url $photoThumbnailURL = $Flickr->getPhotoURL($photo, $size = "thumbnail"); //$imagePathLarge = "http://farm{$farmId}.staticflickr.com/{$serverId}/{$id}_{$secret}_b.jpg"; //prepare html for each image $id = $photo['id']; $title = $photo['title']; $image = "<div class='thumbnail_wrapper'>"; $image .= "<a href='photo_details.php?photoid={$id}&query={$tags}&page={$page}'>"; $image .= "<img src='{$photoThumbnailURL}' alt='{$title}'>"; $image .= "</a>"; $image .= "<div class='thumbnail_title'>{$title}</div>"; $image .= "</div>"; echo $image; } // if it's not the first page echo "<br>"; echo "<div class='pagination_footer'><div>";