} $url = "https://api.flickr.com/services/rest/?sort=relevance" . implode('&', $encoded_params); return $url; } } echo '<form method="get">'; echo '<label>Search : </label><input type"text" name="search" /><br/>'; echo '<label>Result : </label><input type"text" name="count" /> * max : 500<br/>'; echo '<label>Size : </label> <select name="size"> <option value="s">Square</option> <option value="q">Large Square</option> <option value="t">Thumbnail</option> <option value="m">Small</option> <option value="n">Small 320</option> <option value="Med" selected>Medium</option> <option value="o">Original</option> </select><br/>'; echo '<input type="submit" name="submit" value="search" /><br/><hr/>'; echo '</form>'; $search = $_GET['search']; $result = $_GET['count']; $size = $_GET['size']; if ($size > 500) { $size = 500; } $flickr = new flickr('77ba63794367be8f4b47e1b9fb7b9a3d'); $gbr = $flickr->flickr_photos_search($search, $result, $size); foreach ($gbr as $hasil) { echo $hasil . ' '; }
<?php include 'flickr.php'; $a = new flickr('b6ca3b2b79a0f2d14e80fef09cd19de7'); //echo 'SEARCH:<BR>'; $photos = $a->search('restaurante'); $photo_a = $photos[img]; //Ver el maximo de fotos y obtener uno al azar $max = 100; //echo($max); $rnd = rand(1, $max); //echo("rnd: ".$rnd); // $photo_b = $photo_a[$rnd]; $photo_id = $photo_b['id']; //print_r($photos); //print_r($photos); //print_r($photo_b); //echo($photo_id); //echo 'getRecent:<BR>'; //print_r($a->getRecent(1)); //echo 'getInfo:<BR>'; //print_r($a->getInfo(142796681)); //print_r($a->getInfo($photo_id)); //echo 'getSizes:<BR>'; //print_r($a->getInfo(142796681)); //print_r($a->getSizes($photo_id)); $get_url = $a->getSizes($photo_id); $url = $get_url[4]; $fin = $url[source]; echo '"' . $fin . '"';
function widget_sf_flickr($args) { extract($args); ?> <div id="flickr-feed" class="content-item widget"> <div class="content-dets"> <h3 class="flickr-title">Latest Pictures</h3> <ul class="dets"> <li class="flickr-link"><a href="http://www.flickr.com/photos/<?php echo get_option(THEME_PREFIX . "flickr_name"); ?> /" title="Flickr.com" target="_blank">View More</a></li> </ul> </div> <div class="content-body"> <?php // Get RSS Feed(s) include_once ABSPATH . WPINC . '/feed.php'; include_once TEMPLATEPATH . '/scripts/flickr.php'; $flickr_feed = get_option(THEME_PREFIX . "flickr_feed"); $rss = fetch_feed('' . $flickr_feed . ''); $thumb = 'square'; $full = 'medium'; // Figure out how many total items there are. $flickr_num = get_option(THEME_PREFIX . "flickr_num"); $maxitems = $rss->get_item_quantity($flickr_num); // Build an array of all the items, starting with element 0 (first element). $rss_items = $rss->get_items(0, $maxitems); ?> <?php if ($maxitems == 0) { echo '<li>No items.</li>'; } else { // Loop through each feed item and display each item as a hyperlink. foreach ($rss_items as $item) { $url = flickr::find_photo($item->get_description()); $title = flickr::cleanup($item->get_title()); $full_url = flickr::photo($url, $full); $thumb_url = flickr::photo($url, $thumb); ?> <a class="preview" href="<?php echo $item->get_permalink(); ?> " rel="<?php echo $full_url; ?> "> <img class="flickr-img" src="<?php echo $thumb_url; ?> " alt="<?php echo $item->get_title(); ?> " /> </a> <?php } } ?> </div> </div> <!-- flickr-feed --> <?php }
<?php include 'flickr.php'; $a = new flickr('b6ca3b2b79a0f2d14e80fef09cd19de7'); echo 'SEARCH:<BR>'; $photos = $a->search('restaurante'); $photo_a = $photos[img]; //Ver el maximo de fotos y obtener uno al azar $max = 100; echo $max; $rnd = rand(1, $max); echo "rnd: " . $rnd; // $photo_b = $photo_a[$rnd]; $photo_id = $photo_b['id']; //print_r($photos); //print_r($photos); //print_r($photo_b); echo $photo_id; //echo 'getRecent:<BR>'; //print_r($a->getRecent(1)); echo 'getInfo:<BR>'; //print_r($a->getInfo(142796681)); print_r($a->getInfo($photo_id)); echo 'getSizes:<BR>'; //print_r($a->getInfo(142796681)); print_r($a->getSizes($photo_id)); $get_url = $a->getSizes($photo_id); $url = $get_url[4]; $fin = $url[source]; echo $fin;
$maxitems = $rss->get_item_quantity(get_option('of_flickr_widget_number')); // Build an array of all the items, starting with element 0 (first element). $rss_items = $rss->get_items(0, $maxitems); ?> <?php if($maxitems == 0) echo '<h3>No items.</h3>'; else // Loop through each feed item and display each item as a hyperlink. foreach ( $rss_items as $item ): $url = flickr::find_photo($item->get_description()); $title = flickr::cleanup($item->get_title()); $full_url = flickr::photo($url, $full); $thumb_url = flickr::photo($url, $thumb); ?> <a class="tooltip-e" href="<?php echo $item->get_permalink(); ?>" title="<?php echo $item->get_title(); ?>" target="_blank"> <img src="<?php echo $thumb_url; ?>" alt="<?php echo $item->get_title(); ?>" /> </a> <?php endforeach; ?> </div> <?php } ?> <?php if(get_option('of_popular_widget') != 'true') { ?> <li id="popular" class="popular widget"> <h3><?php echo get_option('of_popular_widget_title'); ?></h3> <ul> <?php $result = $wpdb->get_results("SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0, 10");
<?php require_once 'class.flickr.php'; $flickr = new flickr('YOUR FLICKR API KEY', 'YOUR FLICKR SECRET KEY', 'json'); $results = $flickr->searchPhotos('pikachu'); foreach ($results as $r) { $src = "http://farm" . $r['farm'] . ".static.flickr.com/" . $r['server'] . '/' . $r['id'] . '_' . $r['secret'] . '_m.jpg'; ?> <img src="<?php echo $src; ?> " alt=""> <?php }