Ejemplo n.º 1
0
<?php

require_once 'flickr.php';
$Flickr = new Flickr();
if (!empty($_GET['q'])) {
    // Remove any hack attempts from input data
    $search_term = htmlspecialchars($_GET['q']);
    $search_term = $_GET['q'];
    $flickr_stream = '';
    $data = $Flickr->search($search_term);
    foreach ($data['photos']['photo'] as $photo) {
        // The geolocation information
        $photo_latlong = array("latitude" => $photo['latitude'], "longitude" => $photo['longitude']);
        // the image URL becomes somthing like
        // http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{secret}.jpg
        $flickr_html = '<a href="http://www.flickr.com/photos/' . $photo["owner"] . '/' . $photo["id"] . '/" target="_blank" rel="nofollow" data-geo=\'' . json_encode($photo_latlong) . '\'><img  border="0" src="http://farm' . $photo["farm"] . '.static.flickr.com/' . $photo["server"] . '/' . $photo["id"] . '_' . $photo["secret"] . '.jpg" width="150" /></a>';
        $flickr_stream .= $flickr_html;
    }
    // Add the google map HTML
    $flickr_stream .= '<div id="google-map"></div>';
    print $flickr_stream;
} else {
    print 'No search terms found';
}
Ejemplo n.º 2
0
<?php

require_once 'includes/settings.php';
require_once 'includes/classes/Flickr.php';
require_once 'includes/db.php';
$flickr = new Flickr(FLICKR_KEY, FLICKR_SECRET);
$data = $flickr->search('mcdonald');
foreach ($data['photos']['photo'] as $photo) {
    echo '<a href="https://www.flickr.com/photos/' . $photo["owner"] . '/' . $photo["id"] . '" target="_blank"><img src="' . 'http://farm' . $photo["farm"] . '.static.flickr.com/' . $photo["server"] . '/' . $photo["id"] . '_' . $photo["secret"] . '_t.jpg"></a>';
}
Ejemplo n.º 3
0
#   Get images ids
###############################################################
/*$keywords = ['big+backpack','white+backpack','blue+bacpack'];
for ($c=0;$c<sizeof($keywords);$c++){
    $data = $google->queryengine($keywords[$c]);
    print_r($data);
    echo '<br/><br/>';

}
exit;*/
if (!empty($addMe)) {
    $info = $queryInput . '+' . $addMe;
} else {
    $info = $queryInput;
}
$data = $Flickr->search($info);
foreach ($data['photos']['photo'] as $photo) {
    $imgid[] = $photo["id"];
}
###############################################################
#   Get tags of each image id
###############################################################
/**
 * Output span with progress.
 *
 * @param $current integer Current progress out of total
 * @param $total   integer Total steps required to complete
 */
function outputProgress($current, $total)
{
    echo "<span style='position: absolute;z-index:{$current};background:greenyellow;'>" . round($current / $total * 100) . "% </span>";
Ejemplo n.º 4
0
<?php

require_once 'includes/settings.php';
require_once 'includes/classes/Flickr.php';
$flickr = new Flickr(FLICKR_KEY, FLICKR_SECRET);
$data = $flickr->search('sun');