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


PHP phpFlickr::photos_getRecent方法代码示例

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


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

示例1: phpFlickr

<?php

/* Last updated with phpFlickr 1.3.2
 *
 * This example file shows you how to call the 100 most recent public
 * photos.  It parses through them and prints out a link to each of them
 * along with the owner's name.
 *
 * Most of the processing time in this file comes from the 100 calls to
 * flickr.people.getInfo.  Enabling caching will help a whole lot with
 * this as there are many people who post multiple photos at once.
 *
 */
require_once "phpFlickr.php";
$f = new phpFlickr("bb204b11214e836e196f0481fa7f90b4");
$recent = $f->photos_getRecent(NULL, 1, 1);
foreach ($recent['photo'] as $photo) {
    $owner = $f->people_getInfo($photo['owner']);
    echo "<a href='http://www.flickr.com/photos/" . $photo['owner'] . "/" . $photo['id'] . "/'>";
    echo $photo['title'];
    echo "</a> Owner: ";
    echo "<a href='http://www.flickr.com/people/" . $photo['owner'] . "/'>";
    echo $owner['username'];
    echo "</a><br>";
}
开发者ID:HDValentin,项目名称:flogr,代码行数:25,代码来源:example.php

示例2: phpFlickr

<?php

exit;
/* Last updated with phpFlickr 1.3.2
 *
 * This example file shows you how to call the 100 most recent public
 * photos.  It parses through them and prints out a link to each of them
 * along with the owner's name.
 *
 * Most of the processing time in this file comes from the 100 calls to
 * flickr.people.getInfo.  Enabling caching will help a whole lot with
 * this as there are many people who post multiple photos at once.
 *
 * Obviously, you'll want to replace the "<api key>" with one provided 
 * by Flickr: http://www.flickr.com/services/api/key.gne
 */
require_once "phpFlickr.php";
$f = new phpFlickr("<api key>");
$recent = $f->photos_getRecent();
foreach ($recent['photo'] as $photo) {
    $owner = $f->people_getInfo($photo['owner']);
    echo "<a href='http://www.flickr.com/photos/" . $photo['owner'] . "/" . $photo['id'] . "/'>";
    echo $photo['title'];
    echo "</a> Owner: ";
    echo "<a href='http://www.flickr.com/people/" . $photo['owner'] . "/'>";
    echo $owner['username'];
    echo "</a><br>";
}
开发者ID:edmarmoretti,项目名称:i3geo,代码行数:28,代码来源:example.php

示例3: phpFlickr

<!-- OKTOSHOW --><a href='/classes/viewSource/?path=<?php 
echo $_SERVER['PHP_SELF'];
?>
' target='_blank'>View Source</a><br/><br/><br/>
<?php 
error_reporting(-1);
# Include the PHP Wrapper
require_once "phpFlickr.php";
# Create a new PHP Object
$f = new phpFlickr("48cae78cf83cc1c27f10629e4e451568");
# Fetch all recent photos
$recent = $f->photos_getRecent($jump_to = NULL, $extras = NULL, $per_page = 5, $page = NULL);
foreach ($recent['photos']['photo'] as $thisPhoto) {
    $photoId = $thisPhoto['id'];
    $photoUrl = $f->buildPhotoURL($thisPhoto, $size = "Medium");
    echo "<img src='{$photoUrl}'><br/>";
}
?>



 




开发者ID:ritarafaeli,项目名称:notes,代码行数:18,代码来源:inClass.php

示例4: 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

示例5: getFlickrPhotos

function getFlickrPhotos($target)
{
    global $blogURL, $pluginURL, $configVal;
    requireModel('reader.common');
    requireComponent('Textcube.Model.Paging');
    requireComponent('Textcube.Function.misc');
    $data = misc::fetchConfigVal($configVal);
    $flickruserid = isset($data['flickruserid']) ? $data['flickruserid'] : "";
    require_once "lib/phpFlickr.php";
    $flickr_api_key = "d1038f051000214af2bf694014ca8f98";
    //It's key for plugin. It does not change.
    $f = new phpFlickr($flickr_api_key);
    $listLength = isset($_GET['length']) ? $_GET['length'] : 16;
    $searchKey = isset($_GET['search']) && !empty($_GET['search']) ? urldecode($_GET['search']) : "";
    $photoSets = isset($_GET['photoSets']) && !empty($_GET['photoSets']) ? $_GET['photoSets'] : "";
    $personMode = isset($_GET['person']) ? $_GET['person'] : "my";
    $page = isset($_GET['page']) ? $_GET['page'] : 1;
    $zoomStyle = "flickr";
    ?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link type="text/css" rel="stylesheet" href="<?php 
    echo $pluginURL;
    ?>
/style/default.css" />
	</head>
	<script type="text/javascript">
	//<![CDDA[
		function insertPhoto(_link, _src_m, _src_l, _title, _style){
			var linkTag_A = '', linkTag_B = '', imgTag = '';
			linkTag_A = '<a href="' + _link + '" title="' + _title + '" target="_blank">'; 
			linkTag_B = '</a>';
			imgTag	= '<img src="' + _src_m + '" border="0" />';

			var isWYSIWYG = false;
			try{
				if(parent.editor.editMode == 'WYSIWYG')
					isWYSIWYG = true;
			}
			catch(e){ }
			if(isWYSIWYG) {
				parent.editor.command('Raw', (linkTag_A + imgTag), linkTag_B);
			}else{
				parent.insertTag(parent.editor.textarea, (linkTag_A + imgTag), linkTag_B);
			}
		}
	//]]>
	</script>
	<body style="margin:0;padding:0;border:none;background-color:#ffffff;">
	<div id="photosBody" style="height:200px;width:100%;overflow-x:hidden;overflow-y:auto;background-color:#fff;">
	<?php 
    if ($personMode == "my" && !empty($flickruserid) && empty($searchKey)) {
        if (!empty($photoSets)) {
            $photoset = $f->photosets_getPhotos($photoSets, "owner_name", NULL, $listLength, $page);
            $photos['photos'] = $photoset['photoset'];
        } else {
            $photos = $f->people_getPublicPhotos($flickruserid, NULL, NULL, $listLength, $page);
        }
        foreach ($photos['photos']['photo'] as $photo) {
            $_output = getFlickrPhotosInfo($photo, $zoomStyle, $flickruserid);
            echo $_output;
        }
    } else {
        if (($personMode == "my" || $personMode == "all") && !empty($searchKey)) {
            if ($personMode == "my" && !empty($flickruserid)) {
                $searchArray = array("user_id" => $flickruserid, "text" => $searchKey, "sort" => "date-posted-desc", "per_page" => $listLength, "page" => $page);
            } else {
                $searchArray = array("text" => $searchKey, "sort" => "date-posted-desc", "per_page" => $listLength, "page" => $page);
            }
            $photos['photos'] = $f->photos_search($searchArray);
            if ($photos['photos']['total'] > 0) {
                foreach ($photos['photos']['photo'] as $photo) {
                    $_output = getFlickrPhotosInfo($photo, $zoomStyle);
                    echo $_output;
                }
            } else {
                echo '<p style="margin-top:30px; text-align:center; font-size:9pt;">Flickr did not find any photos. Please input title, description or tags.</p>';
            }
        } else {
            if ($personMode == "all" && empty($searchKey)) {
                $photos['photos'] = $f->photos_getRecent(NULL, $listLength, $page);
                foreach ($photos['photos']['photo'] as $photo) {
                    $_output = getFlickrPhotosInfo($photo, $zoomStyle);
                    echo $_output;
                }
            } else {
                echo '<p style="margin-top:30px; text-align:center; font-size:9pt;">Flickr did not find any photos.', !$nickName ? '(Input title, description or tags.)' : '', '</p>';
            }
        }
    }
    $pageLink = '?person=' . $personMode . '&photoSets=' . $photoSets . '&length=' . $listLength . '&search=' . rawurlencode($searchKey);
    //$photos['total'] = $photos['total'] > 996 ? 996 : $photos['total'];
    $paging = HC_getFetchWithPaging($photos['photos']['total'], $page, $listLength, "{$blogURL}/plugin/flickrPhotos", $pageLink . "&page=");
    $pagingTemplate = '[##_paging_rep_##]';
    $pagingItemTemplate = '<a [##_paging_rep_link_##] class="num">[##_paging_rep_link_num_##]</a>';
    $prev_page = isset($paging['prev']) ? " href=\"{$pageLink}&page={$paging['prev']}\" " : '';
    $next_page = isset($paging['next']) ? " href=\"{$pageLink}&page={$paging['next']}\" " : '';
    $no_more_prev = isset($paging['prev']) ? '' : 'no-more-prev';
//.........这里部分代码省略.........
开发者ID:hinablue,项目名称:TextCube,代码行数:101,代码来源:index.php


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