photosets_getPhotos($photoset_id); foreach ($photos['photoset']['photo'] as $photo){ print "buildPhotoURL($photo, 'medium') . "\" title=\"" . $photo['title'] . "\">"; print " buildPhotoURL($photo, 'square') . "\" alt=\"" . $photo['title'] . "\" title=\"" . $photo['title'] . "\" />"; print ""; } } $gallery_ID = $_GET['gallery_ID']; if(!isset($gallery_ID)) { // show all galleries // build FLICKR FIRST # # build the API URL to call # $params = array( 'api_key' => '3cc73f6fe9f8266b0559fb6c9e461cd3', //'method' => 'flickr.photos.getInfo', 'method' => 'flickr.photosets.getList', 'photo_id' => '251875545', 'format' => 'php_serial', 'user_id' => '80891809@N04' ); $encoded_params = array(); foreach ($params as $k => $v){ $encoded_params[] = urlencode($k).'='.urlencode($v); } # # call the API and decode the response # $url = "http://api.flickr.com/services/rest/?".implode('&', $encoded_params); // echo $url; $rsp = file_get_contents($url); $rsp_obj = unserialize($rsp); if ($rsp_obj['stat'] == 'ok'){ $photo_title = $rsp_obj['photo']['title']['_content']; $result_array = $rsp_obj['photosets']['photoset']; $total_sets = $rsp_obj['photosets']['total']; //echo $total_sets; for($i = 0; $i < $total_sets; $i++) { $this_set = $result_array[$i]; $col_count++; $right_margin = $col_count % 3 == 0 ? "margin-right:0px;" : "margin-right:15px;"; print "
"; print " "; print "
"; print " " . $this_set['title']['_content'] . "
"; print " " . date('l jS F Y', $this_set['date_create']) . ""; print "
"; print "
"; } } else { echo "Call failed!"; } // THEN BUILD IN-HOUSE GALLERIES $sql = mysql_query("SELECT * FROM `link_galleries` WHERE `is_public` = 1 ORDER BY `date` DESC"); $all_rows = mysql_num_rows($sql); for($i = 0; $i < $all_rows; $i++) { $row = mysql_fetch_array($sql); $this_gallery = $row['gallery_ID']; $media = mysql_query("SELECT * FROM `link_media` NATURAL JOIN `link_media2gallery` WHERE `gallery_ID` = $this_gallery ORDER BY `order` LIMIT 1"); $media_row = mysql_fetch_array($media); $col_count++; $right_margin = $col_count % 3 == 0 ? "margin-right:0px;" : "margin-right:15px;"; print "
"; print " "; print "
"; print " " . html_entity_decode($row['gallery_name']) . "
"; print " " . html_entity_decode($row['location']) . "
"; print " " . date('l jS F Y', strtotime($row['date'])) . ""; print "
"; print "
"; } } else { // we have a gallery ID - build the gallery print "
◀ Back to all galleries


"; if($_GET['is_flickr'] == true) { // FLICKR FIRST # # build the API URL to call # $params = array( 'api_key' => '3cc73f6fe9f8266b0559fb6c9e461cd3', 'method' => 'flickr.photosets.getPhotos', 'photoset_id' => $gallery_ID, 'format' => 'php_serial', 'user_id' => '80891809@N04' ); $encoded_params = array(); foreach ($params as $k => $v){ $encoded_params[] = urlencode($k).'='.urlencode($v); } # # call the API and decode the response # $url = "http://api.flickr.com/services/rest/?".implode('&', $encoded_params); $rsp = file_get_contents($url); $rsp_obj = unserialize($rsp); $col_count = 0; if ($rsp_obj['stat'] == 'ok'){ //print_r($rsp_obj); $photo_title = $rsp_obj['photo']['title']['_content']; $result_array = $rsp_obj['photoset']['photo']; $total_sets = $rsp_obj['photoset']['total']; print "

" . stripslashes($_GET['gallery_title']) . "





"; //print "
" . html_entity_decode($row['gallery_introduction']) . "




"; for($i = 0; $i < $total_sets; $i++) { $this_set = $result_array[$i]; $col_count++; if($col_count % 3 == 0) { $margin = "0px"; $break = "
"; } else { $margin = "15px"; $break = ""; } //$margin = $col_count % 3 == 0 ? "0px;" : "15px"; print "
"; print " "; print " "; print " "; print "
"; print " " . $this_set['title'] . "
"; print "
"; print "
" . $break; } } else { echo "call failed"; } } else { $col_count = 0; // THEN IN-HOUSE //print "
"; $sql = mysql_query("SELECT * FROM `link_galleries` WHERE `gallery_ID` = $gallery_ID"); $row = mysql_fetch_array($sql); print "

" . html_entity_decode($row['gallery_name']) . "



"; print "
" . html_entity_decode($row['gallery_introduction']) . "




"; $sql = mysql_query("SELECT * FROM `link_media` NATURAL JOIN `link_media2gallery` WHERE `gallery_ID` = $gallery_ID ORDER BY `media_order`"); $all_rows = mysql_num_rows($sql); for($i = 1; $i <= $all_rows; $i++) { $row = mysql_fetch_array($sql); $col_count++; $margin = $col_count % 3 == 0 ? "0px;" : "15px"; print "
"; if($row['media_type'] == "video") { $vim_link = end(explode('/', $row['media_link'])); $hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/$vim_link.php")); print "
"; print " "; print " "; print " "; print "
"; } else { print " "; print " "; print " "; } print "
"; print " " . html_entity_decode($row['gallery_name']) . "
"; print " " . html_entity_decode($row['location']) . "
"; print " " . date('l jS F Y', strtotime($row['date'])) . ""; print "
"; print "
"; } } } ?>