当前位置: 首页>>代码示例>>PHP>>正文


PHP phpFlickr::photos_search方法代码示例

本文整理汇总了PHP中phpFlickr::photos_search方法的典型用法代码示例。如果您正苦于以下问题:PHP phpFlickr::photos_search方法的具体用法?PHP phpFlickr::photos_search怎么用?PHP phpFlickr::photos_search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在phpFlickr的用法示例。


在下文中一共展示了phpFlickr::photos_search方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getFotos

 public function getFotos()
 {
     $f = new phpFlickr("f8dfa483443f9424a79d73c50344b90c");
     //Clase de Api, conseguir en: http://www.flickr.com/services/api/keys/
     $nsid = "139950084@N02";
     //NSID Usuario, conseguir en: http://idgettr.com/
     //Incluir tag, ordenamieno, privacidad, y numero de imagenes a mostrar
     $tagsList = $f->tags_getListUser($nsid);
     $j = 0;
     foreach ($tagsList as $tagl) {
         $photos = $f->photos_search(array("tags" => $tagl['_content'], "user_id" => $nsid, "sort" => "date-posted-desc", "privacy_filter" => "1"));
         //$photoList[$tagl['_content']] = $photos['photo'];
         $i = 0;
         $photoList[$j]['tag'] = $tagl['_content'];
         foreach ($photos['photo'] as $photo) {
             $photoList[$j]['photos'][$i]['id'] = $photo['id'];
             $photoList[$j]['photos'][$i]['url'] = $f->buildPhotoURL($photo, "Medium 640");
             $i++;
         }
         $j++;
         /*	if (is_array($photos['photo'])){
         				$i = 0;
         				foreach ($photos['photo'] as $photo){
         						$photoList[$tagl['_content']][$i] = $f->buildPhotoURL($photo, "Medium 640");
         				}
         			}*/
     }
     return $photoList;
 }
开发者ID:royergarci,项目名称:ipc,代码行数:29,代码来源:Fotos.php

示例2: searchFlickr

function searchFlickr($keywords, $page)
{
    $retval = array();
    $data = array();
    $f = new phpFlickr('5bc169cff7b9121c0c93f9b8804b1116');
    $args = array("tags" => $keywords, "tag_mode" => "all", "sort" => "relevance", "per_page" => "10", "page" => $page);
    $photos = $f->photos_search($args);
    //decide not to show the photo beyond page 400;
    $totalPages = min($photos['pages'], 400);
    if ($totalPages > 0) {
        $i = 0;
        foreach ($photos['photo'] as $photo) {
            $user = $f->people_getInfo($photo['owner']);
            $data[$i] = array('id' => $photo['id'], 'title' => $photo['title'], 'author' => $user['username'], 'image' => $f->buildPhotoURL($photo, "Square"));
            $i++;
        }
        $retval['status'] = 'OK';
        $retval['statusmsg'] = 'OK';
        $retval['totalpages'] = $totalPages;
        $retval['currentpage'] = $page;
        $retval['data'] = $data;
    } else {
        $retval['status'] = 'NA';
        $retval['statusmsg'] = 'NA';
    }
    return $retval;
}
开发者ID:uhdyi,项目名称:blacklist,代码行数:27,代码来源:FlickrService.php

示例3: total_photo

function total_photo($tags)
{
    $o = new phpFlickr('6791ccf468e1c2276c1ba1e0c41683a4');
    $d = $o->photos_search(array('tags' => $tags, 'content_type' => 1, 'sort' => 'date-posted-asc', 'extras' => 'url_o,url_l', 'page' => 1, 'per_page' => 500));
    print_r("total page :" . $d['pages']);
    $total_page = $d['pages'];
    print_r("total photo :" . $d['total']);
    $total_photo = $d['total'];
    $dir = str_replace(" ", "_", $tags);
    system(" mkdir {$dir}");
    photo_list($tags, 1, 500);
}
开发者ID:hannibal0112,项目名称:php_flickr_download,代码行数:12,代码来源:download_tag_500_V2.php

示例4: display

 function display()
 {
     $flickr = new phpFlickr(ModUtil::getVar('Content', 'flickrApiKey'));
     $flickr->enableCache("fs", System::getVar('temp'));
     // Find the NSID of the username
     $person = $flickr->people_findByUsername($this->userName);
     // Get the photos
     //$photos = $flickr->people_getPublicPhotos($person['id'], NULL, $this->photoCount);
     $photos = $flickr->photos_search(array('user_id' => $person['id'], 'tags' => $this->tags, 'per_page' => $this->photoCount));
     $photoData = array();
     foreach ((array) $photos['photo'] as $photo) {
         $photoData[] = array('title' => DataUtil::formatForDisplayHTML($this->decode($photo['title'])), 'src' => $flickr->buildPhotoURL($photo, "Square"), 'url' => "http://www.flickr.com/photos/{$photo['owner']}/{$photo['id']}");
     }
     $this->view->assign('photos', $photoData);
     return $this->view->fetch($this->getTemplate());
 }
开发者ID:robbrandt,项目名称:Content,代码行数:16,代码来源:Flickr.php

示例5: total_photo

function total_photo($tags, $camera)
{
    $o = new phpFlickr('6791ccf468e1c2276c1ba1e0c41683a4');
    $d = $o->photos_search(array('tags' => $tags, 'content_type' => 1, 'sort' => 'date-posted-asc', 'camera' => $camera, 'extras' => 'url_o,url_l', 'page' => 1, 'per_page' => 500));
    print_r("total page :" . $d['pages']);
    $total_page = $d['pages'];
    print_r("total photo :" . $d['total']);
    $total_photo = $d['total'];
    for ($page = 1; $total_page >= $page; $page++) {
        print "page {$page} \n";
        if ($total_photo >= 500) {
            $total_photo -= 500;
            photo_list($tags, $camera, $page, 500);
        } else {
            photo_list($tags, $camera, $page, $total_photo);
        }
    }
}
开发者ID:hannibal0112,项目名称:php_flickr_download,代码行数:18,代码来源:d_flickr.php

示例6: total_photo

function total_photo($tags)
{
    $o = new phpFlickr('6791ccf468e1c2276c1ba1e0c41683a4');
    $tags = trim(preg_replace('/\\s\\s+/', ' ', $tags));
    $d = $o->photos_search(array('user_id' => $tags, 'content_type' => 1, 'sort' => 'date-posted-asc', 'extras' => 'url_m,url_z', 'page' => 1, 'per_page' => 500));
    print_r("total page :" . $d['pages']);
    $total_page = $d['pages'];
    print_r("total photo :" . $d['total']);
    $total_photo = $d['total'];
    for ($page = 1; $total_page >= $page; $page++) {
        print "page {$page} \n";
        if ($total_photo >= 500) {
            $total_photo -= 500;
            photo_list($tags, $page, 500);
        } else {
            photo_list($tags, $page, $total_photo);
        }
    }
}
开发者ID:hannibal0112,项目名称:php_flickr_download,代码行数:19,代码来源:download_ID_Sets_V1.php

示例7: listafotosflickr

function listafotosflickr()
{
    global $ret, $cp, $key, $texto, $ai, $af, $page;
    $ret = explode(" ", $ret);
    $ret = implode(",", $ret);
    $resultado = "";
    if ($ai != "") {
        $ai = strtotime("1 Jan " . $ai);
    }
    // echo strtotime("10 September 2000")
    if ($af != "") {
        $af = strtotime("31 Dec " . $af);
    }
    $f = new phpFlickr($key);
    $recent = @$f->photos_search(array("page" => $page, "extras" => "geo", "accuracy" => "11", "min_upload_date" => $ai, "max_upload_date" => $af, "text" => $texto, "bbox" => $ret, "privacy_filter" => "1"));
    if (!$recent) {
        $recent = "";
    }
    $cp->set_data($recent);
}
开发者ID:edmarmoretti,项目名称:i3geo,代码行数:20,代码来源:funcoes.php

示例8: displayFlickrPhotos

function displayFlickrPhotos()
{
    if (isset($_GET['q']) && isset($_GET['maxResults'])) {
        $flickrKey = 'b1a69066d658530df604321f514b72d0';
        $flickrSecret = '9e0e977d109675fa';
        require_once 'phpFlickr.php';
        $f = new phpFlickr($flickrKey);
        $recent = $f->photos_search(array("tags" => $_GET['q'], "tag_mode" => "any", "per_page" => $_GET['maxResults'], "extras" => "url_sq"));
        $url = array();
        $urls = array();
        if (count($recent['photo']) < 1) {
            echo '<h5>There are no Results Found</h5>';
        } else {
            foreach ($recent['photo'] as $photo) {
                $urls[] = $f->buildPhotoURL($photo, "Medium");
            }
            foreach ($urls as $url) {
                echo '<img src="' . $url . '">';
            }
        }
    }
}
开发者ID:Rakesh-Inampudi,项目名称:flickrtube2,代码行数:22,代码来源:clubingAPI.php

示例9: index

 public function index()
 {
     $this->template->content = new View('flickrwijit_front');
     //fetch flickrwijit settings from db
     $flickrwijit_settings = ORM::factory('flickrwijit', 1);
     // include phpflickr library
     include Kohana::find_file('libraries/phpflickr', 'phpFlickr');
     $f = new phpFlickr(Kohana::config('flickrwijit.flick_api_key'));
     //enable caching
     if ($flickrwijit_settings->enable_cache == 1) {
         $f->enableCache("fs", "application/cache");
     }
     $pagination = new Pagination(array('query_string' => 'page', 'items_per_page' => (int) Kohana::config('settings.items_per_page'), 'total_items' => $flickrwijit_settings->num_of_photos));
     //print_r($pagination);
     $photos = $f->photos_search(array('page' => $pagination->current_page, 'tags' => $flickrwijit_settings->flickr_tag, 'per_page' => (int) Kohana::config('settings.items_per_page'), 'user_id' => $flickrwijit_settings->flickr_id));
     $this->template->content->image_width = $flickrwijit_settings->image_width;
     $this->template->content->image_height = $flickrwijit_settings->image_height;
     $this->template->content->num_of_photos = $flickrwijit_settings->num_of_photos;
     $this->template->content->f = $f;
     $this->template->content->photos = $photos;
     $this->template->content->pagination = $pagination;
 }
开发者ID:eyedol,项目名称:flickrwijit,代码行数:22,代码来源:flickrwijit.php

示例10: displayFlickr

 public function displayFlickr($FlickrKey, $FlickrWhat, $FlickrWhere, $DisplayCount, $RandomCount, $width)
 {
     $f = new phpFlickr($FlickrKey);
     $returnurl = '';
     $trycount = 1;
     $FlickrSearch = $FlickrWhat . ", " . $FlickrWhere;
     $photocount = $DisplayCount;
     //echo "Search - " . $FlickrSearch . "<br />";
     //echo "Count - " . $RandomCount . "<br />";
     $search = $f->photos_search(array("text" => $FlickrSearch, "tag_mode" => "any", "per_page" => $RandomCount, "license" => "Attribution Creative Commons"));
     //var_dump($search);
     $TotalCount = $search['total'];
     //echo "Count - " . $TotalCount . "<br />";
     if ($TotalCount < $RandomCount) {
         $RandomCount = $TotalCount;
     }
     // Create the illusion of random photo
     $RandomPhoto = rand(1, $RandomCount);
     foreach ($search['photo'] as $photo) {
         //echo $photocount . ' == ' . $RandomPhoto . '<br />';
         if ($photocount == $RandomPhoto) {
             $photo_id = $photo['id'];
             $photo_owner = $photo['owner'];
             $photo_title = $photo['title'];
             $photo_farm = $photo['farm'];
             $photo_server = $photo['server'];
             $photo_secret = $photo['secret'];
             $url = "http://www.flickr.com/photos/" . $photo_owner . "/" . $photo_id . "/";
             // Build the HTML for an image to return
             $returnurl = '<center><a href="' . $url . '" class="img">';
             $returnurl .= '<img src="http://farm' . $photo_farm . '.staticflickr.com/' . $photo_server . '/' . $photo_id . '_' . $photo_secret . '.jpg" width="' . $width . '" />';
             $returnurl .= '<div>' . $FlickrWhere . '</div>';
             $returnurl .= '</a></center>';
         }
         $photocount++;
     }
     return $returnurl;
 }
开发者ID:haive,项目名称:CityGrid-PHP-Local-Directory-Starter-Kit,代码行数:38,代码来源:class-flickr-photos.php

示例11: flickrTagmatch

function flickrTagmatch($keywords = "", $mode, $count, $page, $date = 0, $sort = "interestingness-desc", $user = "", $test = false)
{
    global $site;
    if ($keywords != "") {
        $keywords = str_replace(".", "", $keywords);
        $parameters["tags"] = $keywords;
        $parameters["tag_mode"] = $mode;
    }
    $f = new phpFlickr($site["flickr"]["key"]);
    $f->enableCache("fs", $site["path"] . $site["folder"] . $site["flickr"]["cache"], $site["flickr"]["cacheduration"]);
    $parameters["sort"] = $sort;
    if ($user != "") {
        //No license restrictions when specifying a user.
        $parameters["user_id"] = $user;
    } else {
        $parameters["license"] = "1,2,3,4,5,6,7";
    }
    $parameters["per_page"] = "" . $count;
    $parameters["page"] = "" . $page;
    if ($date != 0) {
        $timeStart = strtotime(date("Y-m-d 0:0:0", $date));
        $timeEnd = strtotime(date("Y-m-d 23:59:59", $date));
        $parameters["min_taken_date"] = $timeStart;
        $parameters["max_taken_date"] = $timeEnd;
    }
    $parameters["content_type"] = "1";
    $parameters["extras"] = "license,owner_name,url_o,url_l,url_c,url_z,url_n";
    $tagmatch = $f->photos_search($parameters);
    if ($test) {
        print "<pre>";
        print_r($parameters);
        print_r($tagmatch);
        print "</pre>";
    }
    return $tagmatch;
}
开发者ID:ntctbt,项目名称:LoremFlickr,代码行数:36,代码来源:functions.php

示例12: phpFlickr

    </head>
    <body>
        <!--[if lt IE 8]>
            <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->

    <div class="container">
      <h1 class="title"><?php 
echo $PAGE_TITLE;
?>
</h1>
      <!-- Example row of columns -->
      <ul class="photo-gallery">
        <?php 
$f = new phpFlickr($API_KEY);
$search = $f->photos_search(array("tags" => $SEARCH_TAGS, "tag_mode" => "any"));
foreach ($search['photo'] as $photo) {
    echo "<li>";
    echo "<a class='image-link' href='http://www.flickr.com/photos/" . $photo['owner'] . "/" . $photo['id'] . "/'>" . "<img class='img-circle' src='http://farm" . $photo['farm'] . ".static.flickr.com/" . $photo['server'] . "/" . $photo['id'] . "_" . $photo['secret'] . "_s.jpg' alt='" . $photo['title'] . "'/>" . "</a> <br>" . "<a class='owner-link' href='http://www.flickr.com/people/" . $photo['owner'] . "/'>credits</a>";
    echo "</li>";
}
?>
      </ul>

      <hr>

      <footer>
        <p>Photos come from Flickr Public API</p>
      </footer>
    </div> <!-- /container -->
开发者ID:edsonmendieta,项目名称:wats1030-dynamic-page,代码行数:30,代码来源:index.php

示例13: getExternalImages

function getExternalImages($layer_tablename,$row_id){
	 require_once("phpFlickr/phpFlickr.php");
  $f = new phpFlickr("fcd1d2106cda125b6b87f2e131357f12", "cee841f34bf60a97");

  $flickr_photos = array();

  $query = "select layer_name,layer_type,title_column from \"Meta_Layer\" where layer_tablename = '%s'";
  $result = db_query($query, $layer_tablename);
  if(!$result) {
  } else {
    $obj = db_fetch_object($result);
    $layer_name = $obj->layer_name;
    $layer_type = $obj->layer_type;
    $title_column = $obj->title_column;
    $tags = "india," . $layer_name;

    switch($layer_type) {
      case 'POINT':
      case 'MULTIPOINT':
        $query = 'select %s as title, asText('.AUTO_DBCOL_PREFIX.'topology) as topo from "%s" where '.AUTO_DBCOL_PREFIX.'id = %d';
        $query_args = array(str_replace("'", '"', $title_column), $layer_tablename, $row_id);
        $result = db_query($query, $query_args);
        if(!$result) {
        } else {
          if($obj = db_fetch_object($result)) {
            $title = $obj->title;
            $topo = $obj->topo;
            $topo = strstr($topo, "(");
            $topo = str_replace(array("(", ")"), "", $topo);
            $arr_topo = explode(" ", $topo);
            $lon = $arr_topo[0];
            $lat = $arr_topo[1];

            $tags = $tags . "," . $title;

            $tags = str_replace(" ", ",", $tags);
            $flickr_photos = $f->photos_search(array("api_keys"=>"fcd1d2106cda125b6b87f2e131357f12", "lon"=>$lon, "lat"=>$lat, "radius"=>"0.095", "tags"=>$tags, "per_page"=>30, "privacy_filter"=>1, "content_type"=>1));
            $delta = 0.002;
            $loc[0] = $lon - $delta;
            $loc[1] = $lat - $delta;
            $loc[2] = $lon + $delta;
            $loc[3] = $lat + $delta;
            $url = "http://www.panoramio.com/map/get_panoramas.php?order=popularity&set=popular&from=0&to=30&minx=".$loc[0]."&miny=".$loc[1]."&maxx=".$loc[2]."&maxy=".$loc[3]."&size=square";
            $panoramio_json = json_decode(file_get_contents($url));
          } else {
            die("No record found");
          }
        }
        break;
      default:
        $query = "select %s as title, ST_XMin(box3d(".AUTO_DBCOL_PREFIX."topology)) || ',' || ST_YMin(box3d(".AUTO_DBCOL_PREFIX."topology)) || ',' || ST_XMax(box3d(".AUTO_DBCOL_PREFIX."topology)) || ',' || ST_YMax(box3d(".AUTO_DBCOL_PREFIX."topology)) as bbox from \"%s\" where ".AUTO_DBCOL_PREFIX."id = %d";
        $query_args = array(str_replace("'", "", $title_column), $layer_tablename, $row_id);
        $result = db_query($query, $query_args);
        if(!$result) {
        } else {
          if($obj = db_fetch_object($result)) {
            $title = $obj->title;
            $bbox = $obj->bbox;
            $tags = $tags . "," . $title;
            $tags = str_replace(" ", ",", $tags);
            $flickr_photos = $f->photos_search(array("api_keys"=>"fcd1d2106cda125b6b87f2e131357f12", "bbox"=>$bbox, "tags"=>$tags, "per_page"=>30, "privacy_filter"=>1, "content_type"=>1));
            $loc = explode(",", $bbox);
            $url = "http://www.panoramio.com/map/get_panoramas.php?order=popularity&set=popular&from=0&to=30&minx=".$loc[0]."&miny=".$loc[1]."&maxx=".$loc[2]."&maxy=".$loc[3]."&size=square";
            $panoramio_json = json_decode(file_get_contents($url));
          }
        }
        break;
    }
  }

  return generateUI($flickr_photos,$panoramio_json);

}
开发者ID:rahool,项目名称:maplocator,代码行数:73,代码来源:external_media.php

示例14: phpFlickr

// Insert your Flickr API here:
$f = new phpFlickr("YOUR FLICKR API GOES HERE");
$photos = null;
//Cheap-o caching so it's not fetching a list on every refresh.
$storedCache = unserialize(file_get_contents("./cache/flickrcache"));
if ($storedCache) {
    if ($storedCache[0] >= time()) {
        echo "<!-- Cached! -->\n\n";
        $photos = $storedCache[1];
    }
}
if (is_null($photos)) {
    echo "<!-- No cache hit -->\n\n";
    $tagToSearch = isset($_REQUEST['tag']) ? $_GET['tag'] : "banana";
    // Tag is passed in via query string by requesting HTML.
    $photos = $f->photos_search(array("tags" => $tagToSearch, "tag_mode" => "all", "per_page" => "500"));
    // Stick the results in the cache for five minutes
    $storedCache = array(time() + 300, $photos);
    file_put_contents("./cache/flickrcache", serialize($storedCache));
}
// Pick a random photo from the array of photo objects returned by phpFlickr
srand((double) microtime() * 1000000);
echo "<!-- Found this many: " . count($photos['photo']) . "-->\n\n";
$randomPhoto = $photos['photo'][rand(0, count($photos['photo']))];
// Construct a link to Flickr's page for the photo.
$imgUrl = "http://static.flickr.com/" . $randomPhoto['server'] . "/" . $randomPhoto['id'] . "_" . $randomPhoto['secret'] . ".jpg";
// Get Flickr's info for this photo for use on the credit line.
$imgInfo = $f->photos_getInfo($randomPhoto['id'], $randomPhoto['secret']);
// Return the display HTML for use by the page (probably in a div).
echo "<img src=" . $imgUrl . "><BR>";
echo "<a href='http://www.flickr.com/photos/" . $randomPhoto['owner'] . "/" . $randomPhoto['id'] . "'>" . $imgInfo['title'] . "</a> by <a href='http://www.flickr.com/people/" . $randomPhoto['owner'] . "/'>" . $imgInfo['owner']['username'] . "</a>";
开发者ID:slambert,项目名称:Why-They-Hate-Us,代码行数:31,代码来源:wthu.php

示例15: getItems

 public function getItems()
 {
     jimport('joomla.filesystem.folder');
     $api_key = '2a4dbf07ad5341b2b06d60c91d44e918';
     $cache_path = JPATH_ROOT . '/cache/test/flickr';
     $nsid = '';
     $photos = array();
     // create cache folder if not exist
     JFolder::create($cache_path, 0755);
     if (!class_exists('phpFlickr')) {
         require_once 'api/phpFlickr.php';
     }
     $f = new phpFlickr($api_key);
     $f->enableCache('fs', $cache_path, $this->get('cache_time'));
     //enable caching
     if ($this->get('flickr_search_from') == 'user') {
         $username = $this->get('flickr_search_from');
         if ($username != NULL) {
             $person = $f->people_findByUsername($username);
             $nsid = $person['id'];
         } else {
             return '';
         }
         $photos = $f->people_getPublicPhotos($nsid, NULL, NULL, $this->get('item_count'));
         $source = $photos['photos']['photo'];
     }
     if ($this->get('flickr_search_from') == 'tags' or $this->get('flickr_search_from') == 'text') {
         $tags = $this->get('flickr_attrs');
         if (!empty($tags)) {
             $attrs = '';
             if ($this->get('flickr_search_from') == 'tags') {
                 $attrs = 'tags';
             }
             if ($this->get('flickr_search_from') == 'text') {
                 $attrs = 'text';
             }
             $photos = $f->photos_search(array($attrs => $tags, 'per_page' => $this->get('item_count')));
             $source = $photos['photo'];
         } else {
             return '';
         }
     }
     if ($this->get('flickr_search_from') == 'recent') {
         $photos = $f->photos_getRecent(NULL, $this->get('item_count'));
         $source = $photos['photo'];
     }
     //$extras = 'description,date_upload,owner_name,tags';
     $items = array();
     $i = 0;
     if (count($source) > 0) {
         foreach ($source as $photo) {
             $id = $photo['id'];
             $obj = new stdClass();
             $info = $f->photos_getInfo($id);
             $nsid = $info['owner']['username'];
             $obj->title = $info['title'];
             $obj->image = $f->buildPhotoURL($photo, '_b');
             $obj->link = $info['urls']['url'][0]['_content'];
             $obj->introtext = $info['description'];
             $obj->date = date('Y.M.d : H:i:s A', $info['dateuploaded']);
             $items[$i] = $obj;
             $i++;
         }
     }
     //return $items;
     var_dump($f);
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:67,代码来源:flickr.php


注:本文中的phpFlickr::photos_search方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。