本文整理汇总了PHP中phpFlickr::people_getInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP phpFlickr::people_getInfo方法的具体用法?PHP phpFlickr::people_getInfo怎么用?PHP phpFlickr::people_getInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpFlickr
的用法示例。
在下文中一共展示了phpFlickr::people_getInfo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: get_images
/**
* get images from flickr
* @author - Henry Addo
* @access - public
* @return - Array of images
*/
public function get_images()
{
$username = "";
$photo_urls = "http://www.flickr.com/photos/eyedol/";
$tags = "tedglobal2007";
// create instance of phpFlickr class
$flickr = new phpFlickr('');
//enable caching
$flickr->enableCache("");
//authenticate
//$flickr->auth();
//get token
//$token = $token['user']['nsid'];
// get NSID of the username
$nsid = $token['user']['nsid'];
$user = $flickr->people_findByUsername($username);
//get the friendly URL of the the users' photos
$photos_url = $flickr->urls_getUserPhotos($username);
// get 20 images of public images of the user
//$photos = $flickr->photos_search( array( 'tags'=>$tags,
//'per_page'=> 200 ) );
$photos = $flickr->people_getPublicPhotos($username, NULL, 36);
// loop through the photos
foreach ((array) $photos['photo'] as $photo) {
$this->images[] = "<li><a href=\"#\">\n <img alt='{$photo['title']}' title='{$photo['title']}'\n src=\"" . $flickr->buildPhotoURL($photo, 'Square') . "\" \n onclick=\"get_image_id('" . $flickr->buildPhotoURL($photo) . "','{$photo['title']}')\"/></a></li>";
$owner = $flickr->people_getInfo($photo[owner]);
$this->owner = $owner['username'];
}
return $this->images;
}
示例3: 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>";
}
示例4: json_encode
<?php
include_once "../include.php";
require_once "./phpFlickr-3.1/phpFlickr.php";
$f = new phpFlickr("94c57f05ba55563f88348d29bdd54593");
$id = $_GET['id'];
$owner = $f->people_getInfo($id);
$retval = new obj();
$retval->status = 0;
$retval->statusMsg = sprintf("success");
$retval->raw = $owner;
$retval->data = $owner;
echo json_encode($retval);
示例5: execute
//.........这里部分代码省略.........
switch ($ext) {
case ".png":
case ".jpeg":
case ".jpg":
case ".gif":
$filename .= $ext;
break;
default:
$filename .= ".jpg";
}
$filename = str_replace("?", "", $filename);
$filename = str_replace(":", "", $filename);
$filename = preg_replace('/ [ ]*/', ' ', $filename);
if (!class_exists("UploadForm")) {
require_once 'includes/SpecialUpload.php';
}
$u = new UploadForm($wgRequest);
//MW 1.12+
$u->mTempPath = $name;
$u->mFileSize = $size;
$u->mComment = $caption;
$u->mSrcName = $filename;
$u->mUploadTempName = $name;
$u->mUploadSize = $size;
$u->mUploadDescription = $caption;
$u->mRemoveTempFile = true;
$u->mIgnoreWarning = true;
$u->mOname = $filename;
$t = Title::newFromText($filename, NS_IMAGE);
if (!$t) {
$wgOut->addHTML("Error - could not create title from filename \"{$filename}\"");
return;
}
if ($t->getArticleID() > 0) {
$sk = $wgUser->getSkin();
$dlink = $sk->makeKnownLinkObj($t);
$warning .= '<li>' . wfMsgHtml('fileexists', $dlink) . '</li>';
// use our own upload warning as we dont have a 'reupload' feature
$this->uploadWarning($u);
return;
} else {
$u->execute();
}
}
$wgOut->addHTML(wfMsg('importfreeimages_description') . "<br/><br/>\n\t\t\t<form method=GET action='" . $importPage->getFullURL() . "'>" . wfMsg('search') . ": <input type=text name=q value='" . htmlspecialchars($q) . "'><input type=submit value=" . wfMsg('search') . ">\n\t\t\t</form>");
if ($q != '') {
$page = $_GET['p'];
if ($page == '') {
$page = 1;
}
$f = new phpFlickr($wgIFI_FlickrAPIKey);
$q = $_GET['q'];
// TODO: get the right licenses
$photos = $f->photos_search(array("{$wgIFI_FlickrSearchBy}" => "{$q}", "tag_mode" => "any", "page" => $page, "per_page" => $wgIFI_ResultsPerPage, "license" => $wgIFI_FlickrLicense, "sort" => $wgIFI_FlickrSort));
$i = 0;
if ($photos == null || !is_array($photos) || sizeof($photos) == 0 || !isset($photos['photo'])) {
$wgOut->addHTML(wfMsg("importfreeimages_nophotosfound", $q));
return;
}
$sk = $wgUser->getSkin();
$wgOut->addHTML("\n\t\t\t\t<style type='text/css' media='all'>/*<![CDATA[*/ @import '/extensions/ImportFreeImages/ifi.css'; /*]]>*/</style>\n\t\t\t\t<div id='photo_results'> " . wfMsg('importfreeimages_results', 'Flickr') . "\n\t\t\t\t<center>\n\t\t\t\t<table cellpadding='4' class='ifi_table'>\n\t\t\t\t<form method='POST' name='uploadphotoform' action='" . $importPage->getFullURL() . "'>\n\t\t\t\t\t<input type='hidden' name='url' value=''/>\n\t\t\t\t\t<input type='hidden' name='id' value=''/>\n\t\t\t\t\t<input type='hidden' name='action' value='submit'/>\n\t\t\t\t\t<input type='hidden' name='owner' value=''/>\n\t\t\t\t\t<input type='hidden' name='name' value=''/>\n\t\t\t\t\t<input type='hidden' name='ititle' value=''/>\n\t\t\t\t</form>\t\n\t\t<script type=\"text/javascript\">\n\t\n\t\t\tfunction s2 (url, id, owner, name, ititle) {\n\t\t\t\tresults = document.getElementById('photo_results');\n\t\t\t\tdocument.uploadphotoform.url.value = url;\n\t\t\t\tdocument.uploadphotoform.id.value = id;\n\t\t\t\tdocument.uploadphotoform.owner.value = owner;\n\t\t\t\tdocument.uploadphotoform.name.value = name;\n\t\t\t\tdocument.uploadphotoform.ititle.value = ititle;\n\t\t\t\tif (" . ($wgIFI_PromptForFilename ? "true" : "false") . ") {\n\t\t\t\t\tititle = ititle.replace(/\\+/g, ' ');\n\t\t\t\t\tdocument.uploadphotoform.ititle.value = prompt('" . wfMsg('importfreeimages_promptuserforfilename') . "', unescape(ititle));\n\t\t\t\t\tif (document.uploadphotoform.ititle.value == '') {\n\t\t\t\t\t\tdocument.uploadphotoform.ititle.value = ititle;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdocument.uploadphotoform.submit();\n\t\t\t\tresults.innerHTML = '" . wfMsg('importfreeimages_uploadingphoto') . "';\n\t\t\t}\n\t\n\t\t</script>\n\t\t\t\t");
$count = 0;
foreach ($photos['photo'] as $photo) {
$count++;
if ($i % $wgIFI_ResultsPerRow == 0) {
$wgOut->addHTML("<tr>");
}
$owner = $f->people_getInfo($photo['owner']);
$wgOut->addHTML("<td><a href='http://www.flickr.com/photos/" . $photo['owner'] . "/" . $photo['id'] . "/'>");
$wgOut->addHTML($photo['title']);
$wgOut->addHTML("</a><br/>" . wfMsg('importfreeimages_owner') . ": ");
$wgOut->addHTML("<a href='http://www.flickr.com/people/" . $photo['owner'] . "/'>");
$wgOut->addHTML($owner['username']);
$wgOut->addHTML("</a><br/>");
//$wgOut->addHTML( "<img src=http://static.flickr.com/" . $photo['server'] . "/" . $photo['id'] . "_" . $photo['secret'] . "." . "jpg>" );
$url = "http://farm{$photo['farm']}.static.flickr.com/{$photo['server']}/{$photo['id']}_{$photo['secret']}.jpg";
$wgOut->addHTML("<img src=\"http://farm{$photo['farm']}.static.flickr.com/{$photo['server']}/{$photo['id']}_{$photo['secret']}_{$wgIFI_ThumbType}.jpg\">");
$wgOut->addHTML("<br/>(<a href='#' onclick=\"s2('{$url}', '{$photo['id']}','{$photo['owner']}', '" . urlencode($owner['username']) . "', '" . urlencode($photo['title']) . "');\">" . wfMsg('importfreeimages_importthis') . "</a>)\n");
$wgOut->addHTML("</td>");
if ($i % $wgIFI_ResultsPerRow == $wgIFI_ResultsPerRow - 1) {
$wgOut->addHTML("</tr>");
}
$i++;
}
if ($count == 0) {
$wgOut->addHTML(wfMsg('importfreeimages_noresults'));
}
$wgOut->addHTML("</table></center>");
if ($wgIFI_UseAjax) {
$s = htmlspecialchars($wgRequest->getVal('q'));
$gPage = ($page - 1) * 2;
$importjs = HtmlSnips::makeUrlTags('js', array('importfreeimages.js'), '/extensions/ImportFreeImages/', false);
$wgOut->addHTML("<br/><br/>" . wfMsg('importfreeimages_results', $wgIFI_AjaxDomain) . "\n\t\t\t\t\t<script type='text/javascript'>\t\t\t\n\t\t\t\t\t\tvar gAjaxDomain = '{$wgIFI_AjaxDomain}';\n\t\t\t\t\t\tvar gInitialSearch = '{$s}';\n\t\t\t\t\t\tvar gPage = {$gPage};\n\t\t\t\t\t\tvar gImportMsg = '" . wfMsg('importfreeimages_importthis') . "';\n\t\t\t\t\t\tvar gImportMsgManual = '" . wfMsg('importfreeimages_importmanual') . "';\n\t\t\t\t\t\tvar gManualURL= '" . Title::makeTitle(NS_PROJECT, 'Manual Import')->getFullURL() . "';\n\t\t\t\t\t\tvar gMoreInfo='" . wfMsg('importfreeimages_moreinfo') . "';\n\t\t\t\t\t</script>\n\t\t\t\t <script src='http://www.google.com/jsapi?key={$wgIFI_AjaxKey}' type='text/javascript'></script>\n\t\t\t\t\t{$importjs}\n\t\t\t\t \t<div id='searchform' style='width:200px; display:none;'>Loading...</div>\n\t \t\t\t<div id='ajax_results'></div>\n\t\t\t\t");
}
$page = $page + 1;
$wgOut->addHTML("</form>");
$wgOut->addHTML("<br/>" . $sk->makeLinkObj($importPage, wfMsg('importfreeimages_next', $wgIFI_ResultsPerPage), "p={$page}&q=" . urlencode($q)));
$wgOut->addHTML("</div>");
}
}
示例6: redirect
// message after login
case 'logged':
$_SESSION['page_infos'][] = l10n('Successfully logged in to you Flickr account');
redirect(FLICKR_ADMIN . '-import');
break;
// logout
// logout
case 'logout':
unset($_SESSION['phpFlickr_auth_token']);
$_SESSION['page_infos'][] = l10n('Logged out');
redirect(FLICKR_ADMIN . '-import');
break;
// main menu
// main menu
case 'main':
$u = $flickr->people_getInfo($u['id']);
$template->assign(array('username' => $u['username'], 'profile_url' => $u['profileurl'], 'logout_url' => FLICKR_ADMIN . '-import&action=logout', 'list_albums_url' => FLICKR_ADMIN . '-import&action=list_albums', 'import_all_url' => FLICKR_ADMIN . '-import&action=list_all'));
break;
// list user albums
// list user albums
case 'list_albums':
// all albums
$albums = $flickr->photosets_getList($u['id']);
$total_albums = $albums['total'];
$albums = $albums['photoset'];
foreach ($albums as &$album) {
$album['U_LIST'] = FLICKR_ADMIN . '-import&action=list_photos&album=' . $album['id'];
}
unset($album);
// not classed
$wo_albums = $flickr->photos_getNotInSet(NULL, NULL, NULL, NULL, 'photos', NULL, NULL, 1);
示例7: l
$flickr_comments_array = $f->photos_comments_getList($flickr_path[3]);
$flickr_comments = $flickr_comments_array['comments'];
$node->comment_count += count($flickr_comments);
?>
| <?php
print l('comment', $node->field_flickr[0]['embed']);
?>
</div> <!-- flickr-tags -->
<?php
if ($page) {
if (isset($flickr_comments['comment']) && count($flickr_comments['comment'])) {
print '<div class="comment">';
foreach ($flickr_comments['comment'] as $flickr_comment) {
$p = $f->people_getInfo($flickr_comment['author']);
$commenter_icon_url = 'http://static.flickr.com/' . $p['iconserver'] . '/buddyicons/' . $p['nsid'] . '.jpg';
$commenter_icon_alt = t('Flickr icon for ') . $flickr_comment['authorname'];
$commenter_icon_attributes = NULL;
$commenter_icon = theme('image', $commenter_icon_url, $commenter_icon_alt, '', $commenter_icon_attributes, FALSE);
$commenter_icon_link_attributes = array();
$commenter_icon_link_attributes['html'] = TRUE;
$commenter_icon_link_attributes['attributes'] = array();
$commenter_icon_link_attributes['attributes']['class'] = 'flickr-commenter-icon-link';
print l($commenter_icon, $p['photosurl'], $commenter_icon_link_attributes);
print '<div class="author">Submitted by ';
print l($flickr_comment['authorname'], $p['photosurl']);
print ' on ';
print date('D Y-m-d H:i', $flickr_comment['datecreate']);
print ' ';
print l('#', $flickr_comment['permalink']);
示例8: showFlickrPhotos
function showFlickrPhotos($target)
{
global $blogURL, $pluginURL, $configVal;
requireComponent('Textcube.Function.misc');
require_once "lib/phpFlickr.php";
$data = misc::fetchConfigVal($configVal);
$flickruserid = isset($data['flickruserid']) ? $data['flickruserid'] : "";
$flickr_api_key = "d1038f051000214af2bf694014ca8f98";
//It's key for plugin. It does not change.
$f = new phpFlickr($flickr_api_key);
ob_start();
?>
<script type="text/javascript">
//<![CDDA[
function actionFlickr(flag){
var person = document.getElementById("person").value;
var photoSets = (document.getElementById("photoSets")==undefined) ? "" : document.getElementById("photoSets").value;
var length = 16;
var searchKey = document.getElementById("searchKey").value;
var srcTarget = document.getElementById("flickrview");
switch(flag) {
case "search":
var flickrQueryString = "?person=" + person + "&photoSets=" + photoSets + "&length=" + length + "&search=" + encodeURIComponent(searchKey) + "&page=1";
srcTarget.src = "<?php
echo $blogURL;
?>
/plugin/flickrPhotos" + flickrQueryString;
break;
case "allview":
var flickrQueryString = "?person=" + person + "&length=" + length + "&page=1";
srcTarget.src = "<?php
echo $blogURL;
?>
/plugin/flickrPhotos" + flickrQueryString;
break;
case "refresh":
default:
parent.frames['flickrview'].location.reload();
break;
}
}
//]]>
</script>
<div style="margin-top:10px;clear:both;"><strong>• Flickr Photos</strong></div>
<?php
if (!empty($flickruserid)) {
?>
<div id="photosToyHeader" style="margin-top:15px;background-color:#eee;">
<?php
$userInfo = $f->people_getInfo($flickruserid);
echo ' Hello! <strong style="color: #36f;">', $userInfo['username'], '</strong>';
$photosUrl = $userInfo['photosurl'];
?>
</div>
<?php
}
?>
<div style="margin-top:5px;background-color:#fff;"><iframe name="flickrview" id="flickrview" src="<?php
echo $blogURL;
?>
/plugin/flickrPhotos" scrolling="no" style="width:100%;height:200px;margin:0;padding:0;border:0;"></iframe></div>
<div id="photosToolbar" style="background-color:#eee;white-space:nowrap;padding:4px;overflow:hidden;">
<?php
if (!empty($flickruserid)) {
$mySets = $f->photosets_getList($flickruserid);
echo 'Flickr Photosets <select id="photoSets" name="photoSets" size="1">';
foreach ((array) $mySets['photoset'] as $row) {
echo '<option label="', $row['title'], '" value="', $row['id'], '">', $row['title'], '(', $row['photos'], ')</option>';
}
echo '</select> ';
}
?>
Search <select name="person" id="person" value="1"><option label="My" value="my">My</option><option label="All" value="all">All</option></select> <input type="text" name="searchKey" id="searchKey" value="" maxlength="255" /><br /><br />
<img src="<?php
echo $pluginURL;
?>
/images/refresh.gif" width="82" height="16" border="0" alt="" style="cursor:pointer;" onclick="actionFlickr('refresh');return false;" /> <img src="<?php
echo $pluginURL;
?>
/images/search.gif" width="82" height="16" border="0" alt="" style="cursor:pointer;" onclick="actionFlickr('search');return false;" /> <img src="<?php
echo $pluginURL;
?>
/images/allview.gif" width="82" height="16" border="0" alt="" style="cursor:pointer;" onclick="actionFlickr('allview');return false;" />
</div>
<?php
$script = ob_get_contents();
ob_end_clean();
return $target . $script;
}