本文整理汇总了PHP中phpFlickr::urls_getUserPhotos方法的典型用法代码示例。如果您正苦于以下问题:PHP phpFlickr::urls_getUserPhotos方法的具体用法?PHP phpFlickr::urls_getUserPhotos怎么用?PHP phpFlickr::urls_getUserPhotos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpFlickr
的用法示例。
在下文中一共展示了phpFlickr::urls_getUserPhotos方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: flickr_stream
function flickr_stream($username, $api_key)
{
require_once "phpflickr/phpFlickr.php";
$phpFlickrObj = new phpFlickr($api_key);
$phpFlickrObj->enableCache("fs", TEMPLATEPATH . "/cache");
$user = $phpFlickrObj->people_findByUsername($username);
$user_url = $phpFlickrObj->urls_getUserPhotos($user['id']);
$photos = $phpFlickrObj->people_getPublicPhotos($user['id'], NULL, NULL, 9);
foreach ($photos['photos']['photo'] as $photo) {
echo '<a href="' . $user_url . $photo['id'] . '" title="' . $photo['title'] . ' (on Flickr)" target="_blank">';
echo '<img style="width: 64px; height: 64px; margin: 1px; padding: 2px; border: 3px solid #ddd; background: #fff;" class="wp-image" alt="' . $photo['title'] . '" src="' . $phpFlickrObj->buildPhotoURL($photo, "square") . '" />';
echo '</a>';
}
}
示例3: jeg_get_flickr_photo
function jeg_get_flickr_photo($flickrapi, $flickrid, $totalimage)
{
require_once JEG_PLUGIN_DIR . "util/phpFlickr/phpFlickr.php";
$f = new phpFlickr($flickrapi);
$result = $f->people_getPublicPhotos($flickrid, null, null, $totalimage, null);
$photos = array();
if (empty($result)) {
echo $f->getErrorMsg();
} else {
$photosUrl = $f->urls_getUserPhotos($flickrid);
foreach ($result['photos']['photo'] as $photo) {
$photos[] = array('s' => $f->buildPhotoURL($photo, 'square'), 'url' => $photosUrl . $photo['id'], 'title' => $photo['title']);
}
}
return $photos;
}
示例4: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
if (empty($title)) {
$title = false;
}
$flickr_api = $instance['flickr_api'];
$flickr_id = $instance['flickr_id'];
$number = absint($instance['number']);
require_once get_template_directory() . "/includes/widgets/phpFlickr/phpFlickr.php";
$f = new phpFlickr($flickr_api);
//Insert API key here
$f->enableCache("fs", get_template_directory() . "/includes/widgets/cache/");
if (!empty($flickr_id)) {
echo $before_widget;
if ($title) {
echo $before_title;
echo $title;
echo $after_title;
}
$apikey = $f->people_findByUsername($flickr_api);
$person = $f->people_findByUsername($flickr_id);
$photos_url = $f->urls_getUserPhotos($person['id']);
$photos = $f->people_getPublicPhotos($person['id'], NULL, NULL, $number);
echo "<ul class='flickr_images clearfix'>";
foreach ((array) $photos['photos']['photo'] as $photo) {
$photo_url = $f->buildPhotoURL($photo, "Large");
echo "<li><a class='view flickr-img-link' rel='flickr-gallery' target='_blank' href={$photo_url}>";
echo "<img class='flickr' alt='{$photo['title']}' " . "src=" . $f->buildPhotoURL($photo, "Small") . ">";
echo "</a></li>";
}
echo "</ul>";
echo $after_widget;
}
}
示例5: flickrbadge
function flickrbadge($params = array())
{
$defaults = array('key' => false, 'username' => false, 'limit' => 10, 'format' => 'square', 'cache' => true, 'refresh' => 60 * 60 * 2);
$options = array_merge($defaults, $params);
// check the cache dir
$cacheDir = c::get('root.cache') . '/flickrbadge';
dir::make($cacheDir);
// disable the cache if adding the cache dir failed
if (!is_dir($cacheDir) || !is_writable($cacheDir)) {
$options['cache'] = false;
}
if (!$options['key']) {
return false;
}
if (!$options['username']) {
return false;
}
$cacheID = 'flickrbadge/data.' . md5(serialize($options)) . '.php';
if ($options['cache']) {
$cache = cache::modified($cacheID) < time() - $options['refresh'] ? false : cache::get($cacheID);
} else {
$cache = false;
}
if (!empty($cache)) {
return $cache;
}
$flickr = new phpFlickr($options['key']);
$userCacheID = 'flickrbadge/user.' . md5($options['username']) . '.php';
$userCache = $options['cache'] ? cache::get($userCacheID) : false;
$user = false;
$url = false;
if (!empty($userCache)) {
$user = a::get($userCache, 'user');
$url = a::get($userCache, 'url');
}
if (!$user || !$url) {
$user = $flickr->people_findByUsername($options['username']);
$url = $flickr->urls_getUserPhotos($user['id']);
if ($options['cache']) {
cache::set($userCacheID, array('user' => $user, 'url' => $url));
}
}
$photos = $flickr->people_getPublicPhotos($user['id'], NULL, NULL, $options['limit']);
$result = array();
foreach ($photos['photos']['photo'] as $photo) {
$photoCacheID = 'flickrbadge/photo.' . $photo['id'] . '.php';
$info = $options['cache'] ? cache::get($photoCacheID) : false;
if (empty($info)) {
$info = $flickr->photos_getInfo($photo['id']);
if ($options['cache']) {
cache::set($photoCacheID, $info);
}
}
$info = a::get($info, 'photo', array());
$dates = a::get($info, 'dates', array());
$tags = array();
foreach ((array) $info['tags']['tag'] as $t) {
if (!empty($t['raw']) && !$t['machine_tag']) {
$tags[] = $t['raw'];
}
}
$result[] = new obj(array('url' => $url . $photo['id'], 'title' => a::get($info, 'title', $photo['title']), 'description' => @$info['description'], 'src' => $flickr->buildPhotoURL($photo, $options['format']), 'taken' => isset($dates['taken']) ? strtotime($dates['taken']) : false, 'posted' => isset($dates['posted']) ? $dates['posted'] : false, 'lastupdate' => isset($dates['lastupdate']) ? $dates['lastupdate'] : false, 'views' => a::get($info, 'views', 0), 'comments' => a::get($info, 'comments', 0), 'tags' => $tags));
}
$result = new obj($result);
if ($options['cache']) {
cache::set($cacheID, $result);
}
return $result;
}
示例6: unset
$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);
if ($wo_albums['photos']['total'] > 0) {
$albums[] = array('id' => 'not_in_set', 'title' => l10n('Pictures without album'), 'description' => null, 'photos' => $wo_albums['photos']['total'], 'U_LIST' => FLICKR_ADMIN . '-import&action=list_photos&album=not_in_set');
}
$template->assign(array('total_albums' => $total_albums, 'albums' => $albums));
break;
// list photos of an album
// list photos of an album
case 'list_photos':
$self_url = FLICKR_ADMIN . '-import&action=list_photos&album=' . $_GET['album'];
$flickr_prefix = 'flickr-' . $u['username'] . '-';
$flickr_root_url = $flickr->urls_getUserPhotos($u['id']);
// pagination
if (isset($_GET['start'])) {
$page['start'] = intval($_GET['start']);
} else {
$page['start'] = 0;
}
if (isset($_GET['display'])) {
$page['display'] = $_GET['display'] == 'all' ? 500 : intval($_GET['display']);
} else {
$page['display'] = 20;
}
// get photos
if ($_GET['album'] == 'not_in_set') {
$all_photos = $flickr->photos_getNotInSet(NULL, NULL, NULL, NULL, 'photos', NULL, NULL, 500);
$all_photos = $all_photos['photos']['photo'];
示例7: flickrps_createGallery
//.........这里部分代码省略.........
}
}
if ($action === 'tag') {
if (!isset($tags) || strlen($tags) == 0) {
return flickrps_formatError(__('You must specify the tags using the "tags" attribute', 'flickr-photostream'));
}
if ($tags_mode !== 'any' && $tags_mode !== 'all') {
return flickrps_formatError(__('You must specify a valid tags_mode: "any" or "all"', 'flickr-photostream'));
}
}
if ($action === 'grp') {
if (!isset($id) || strlen($id) == 0) {
return flickrps_formatError(__('You must specify the id of the group, using the "id" attribute', 'flickr-photostream'));
}
}
if ($pagination !== 'none' && $pagination !== 'prevnext' && $pagination !== 'numbers') {
return flickrps_formatError(__('The pagination attribute can be only "none", "prevnext" or "numbers".', 'flickr-photostream'));
}
if ($last_row !== 'hide' && $last_row !== 'justify' && $last_row !== 'nojustify') {
return flickrps_formatError(__('The last_row attribute can be only "hide", "justify" or "nojustify".', 'flickr-photostream'));
}
if ($lightbox !== 'none' && $lightbox !== 'colorbox' && $lightbox !== 'swipebox') {
return flickrps_formatError(__('The lightbox attribute can be only "none", "colorbox" or "swipebox".', 'flickr-photostream'));
}
//Photo loading----------------
$extras = "description, original_format, url_l, url_z";
if ($action === 'set') {
//Show the photos of a particular photoset
$photos = $f->photosets_getPhotos($id, $extras, 1, $max_num_photos, $page_num, NULL);
$photos_main_index = 'photoset';
} else {
if ($action === 'gal') {
//Show the photos of a particular gallery
$photos_url[$user_id] = $f->urls_getUserPhotos($user_id);
if ($f->getErrorCode() != NULL) {
return flickrps_formatFlickrAPIError($f->getErrorMsg());
}
$gallery_info = $f->urls_lookupGallery($photos_url[$user_id] . 'galleries/' . $id);
if ($f->getErrorCode() != NULL) {
return flickrps_formatFlickrAPIError($f->getErrorMsg());
}
$photos = $f->galleries_getPhotos($gallery_info['gallery']['id'], $extras, $max_num_photos, $page_num);
$photos_main_index = 'photos';
} else {
if ($action === 'tag') {
$photos = $f->photos_search(array('user_id' => $user_id, 'tags' => $tags, 'tag_mode' => $tags_mode, 'extras' => $extras, 'per_page' => $max_num_photos, 'page' => $page_num));
$photos_main_index = 'photos';
} else {
if ($action === 'grp') {
//Show the photos of a particular group pool
//groups_pools_getPhotos ($group_id, $tags = NULL, $user_id = NULL, $jump_to = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
$photos = $f->groups_pools_getPhotos($id, $tags, NULL, NULL, $extras, $max_num_photos, $page_num);
$photos_main_index = 'photos';
} else {
//Show the classic photostream
$photos = $f->people_getPublicPhotos($user_id, NULL, $extras, $max_num_photos, $page_num);
//Need the authentication (TODO)
//$photos = $f->people_getPhotos($user_id,
// array("privacy_filter" => "1", "extras" => "description", "per_page" => $max_num_photos, "page" => $page_num));
$photos_main_index = 'photos';
}
}
}
}
if ($f->getErrorCode() != NULL) {
return flickrps_formatFlickrAPIError($f->getErrorMsg());
示例8: forward
if (!empty($username)) {
$temp_user = get_user_by_username($username);
} else {
$temp_user = get_loggedin_user();
}
$flickr_username = get_metadata_byname($temp_user->guid, "flickr_username");
if (empty($flickr_username)) {
register_error("No Flickr username set");
echo "<pre>No flickr username set: {$temp_user->guid}";
die;
forward("/");
die;
}
$flickr_user = $f->people_findByUsername($flickr_username->value);
// Get the friendly URL of the user's photos
$photos_url = $f->urls_getUserPhotos($flickr_user["id"]);
if (!empty($flickr_user)) {
$recent = $f->people_getPublicPhotos($flickr_user['id'], NULL, NULL, 5);
} else {
echo "user not found";
die;
}
//echo "<pre>"; var_dump( $recent ); echo "</pre>";
//echo "<pre>"; var_dump( $user ); echo "</pre>";
$body = elgg_view_title("Flickr photos for {$flickr_user['username']}");
$count = 0;
foreach ($recent['photos']['photo'] as $photo) {
$photo_info = $f->photos_getInfo($photo["id"], $photo["secret"]);
$body .= "<div class='tidypics_album_images'>";
$body .= "{$photo_info['title']}<br />Views: {$photo_info['views']}<br />";
$body .= "<a href={$photos_url}{$photo['id']}>";
示例9: retornaGaleriaflickr
public function retornaGaleriaflickr()
{
$site = site_dados();
require_once "flickr/phpFlickr.php";
$f = new phpFlickr("KEY", "SECRET");
$person = $f->people_findByUsername($flickr_channel);
// Get the friendly URL of the user's photos
$photos_url = $f->urls_getUserPhotos($person['id']);
// Get the user's first 36 public photos
$photos = $f->people_getPublicPhotos($person['id'], NULL, NULL, 9);
$i = 0;
foreach ((array) $photos['photos']['photo'] as $photo) {
$retorno[$i]['photo'] = $photo;
$retorno[$i]['photos_url'] = $photos_url;
$retorno[$i]['url']['square'] = $f->buildPhotoURL($photo, "square");
$retorno[$i]['url']['thumbnail'] = $f->buildPhotoURL($photo, "thumbnail");
$retorno[$i]['url']['small'] = $f->buildPhotoURL($photo, "small");
$retorno[$i]['url']['medium'] = $f->buildPhotoURL($photo, "medium");
$retorno[$i]['url']['large'] = $f->buildPhotoURL($photo, "large");
$retorno[$i]['url']['original'] = $f->buildPhotoURL($photo, "original");
$i++;
}
return $retorno;
}
示例10: fjgwpp_createGallery
//.........这里部分代码省略.........
}
}
if ($action === 'tag') {
if (!isset($tags) || strlen($tags) == 0) {
return fjgwpp_formatError(__('You must specify the tags using the "tags" attribute', 'fjgwpp'));
}
if ($tags_mode !== 'any' && $tags_mode !== 'all') {
return fjgwpp_formatError(__('You must specify a valid tags_mode: "any" or "all"', 'fjgwpp'));
}
}
if ($action === 'grp') {
if (!isset($id) || strlen($id) == 0) {
return fjgwpp_formatError(__('You must specify the id of the group, using the "id" attribute', 'fjgwpp'));
}
}
if ($pagination !== 'none' && $pagination !== 'prevnext' && $pagination !== 'numbers') {
return fjgwpp_formatError(__('The pagination attribute can be only "none", "prevnext" or "numbers".', 'fjgwpp'));
}
if ($last_row !== 'hide' && $last_row !== 'justify' && $last_row !== 'nojustify') {
return fjgwpp_formatError(__('The last_row attribute can be only "hide", "justify" or "nojustify".', 'fjgwpp'));
}
if ($lightbox !== 'none' && $lightbox !== 'colorbox' && $lightbox !== 'swipebox') {
return fjgwpp_formatError(__('The lightbox attribute can be only "none", "colorbox" or "swipebox".', 'fjgwpp'));
}
//Photo loading----------------
$extras = "description, original_format, url_l, url_z";
if ($action === 'set') {
//Show the photos of a particular photoset
$photos = $f->photosets_getPhotos($id, $extras, NULL, $max_num_photos, $page_num, NULL);
$photos_main_index = 'photoset';
} else {
if ($action === 'gal') {
//Show the photos of a particular gallery
$photos_url[$user_id] = $f->urls_getUserPhotos($user_id);
if ($f->getErrorCode() != NULL) {
return fjgwpp_formatFlickrAPIError($f->getErrorMsg());
}
$gallery_info = $f->urls_lookupGallery($photos_url[$user_id] . 'galleries/' . $id);
if ($f->getErrorCode() != NULL) {
return fjgwpp_formatFlickrAPIError($f->getErrorMsg());
}
$photos = $f->galleries_getPhotos($gallery_info['gallery']['id'], $extras, $max_num_photos, $page_num);
$photos_main_index = 'photos';
} else {
if ($action === 'tag') {
$photos = $f->photos_search(array('user_id' => $user_id, 'tags' => $tags, 'tag_mode' => $tags_mode, 'extras' => $extras, 'per_page' => $max_num_photos, 'page' => $page_num));
$photos_main_index = 'photos';
} else {
if ($action === 'grp') {
//Show the photos of a particular group pool
//groups_pools_getPhotos ($group_id, $tags = NULL, $user_id = NULL, $jump_to = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
$photos = $f->groups_pools_getPhotos($id, $tags, NULL, NULL, $extras, $max_num_photos, $page_num);
$photos_main_index = 'photos';
} else {
//Show the classic photostream
$photos = $f->people_getPublicPhotos($user_id, NULL, $extras, $max_num_photos, $page_num);
//Need the authentication (TODO)
//$photos = $f->people_getPhotos($user_id,
// array("privacy_filter" => "1", "extras" => "description", "per_page" => $max_num_photos, "page" => $page_num));
$photos_main_index = 'photos';
}
}
}
}
if ($f->getErrorCode() != NULL) {
return fjgwpp_formatFlickrAPIError($f->getErrorMsg());
示例11: dirname
require_once dirname(dirname(__FILE__)) . "/lib/phpFlickr/phpFlickr.php";
$f = new phpFlickr("26b2abba37182aca62fe0eb2c7782050");
$set_id = get_input("set_id");
$album_id = get_input("album_id");
$page_pp = get_input("page");
$return_url = get_input("return_url");
$user = get_loggedin_user();
$flickr_id = get_metadata_byname($user->guid, "flickr_id");
if (empty($flickr_id)) {
register_error(elgg_echo('flickr:errorusername2'));
forward($return_url);
die;
//just in case
}
// Get the friendly URL of the user's photos
$photos_url = $f->urls_getUserPhotos($flickr_id->value);
$photos = $f->photosets_getPhotos($set_id, null, null, 10, $page_pp);
$photos_to_upload = array();
foreach ($photos["photoset"]["photo"] as $photo) {
//check if we already have this image
$meta = get_metadata_byname($user->guid, $photo["id"]);
/*
if ($meta->value == 1) { //we've downloaded this already
register_error( elgg_echo( 'flickr:errorimageimport' ));
continue;
} */
/* Disabled By Rijo Joy */
//store this so we don't download the same photo multiple times
create_metadata($user->guid, $photo["id"], "1", "text", $user->guid, ACCESS_PUBLIC);
$photo_info = $f->photos_getInfo($photo["id"], $photo["secret"]);
$tags = array();
示例12: phpFlickr
<?php
require_once "phpFlickr.php";
$phpFlickrObj = new phpFlickr('665302ccbe82f5ae7aa2328d7ce4f886');
$user = $phpFlickrObj->people_findByUsername('codemastersnake');
$user_url = $phpFlickrObj->urls_getUserPhotos($user['id']);
$photos = $phpFlickrObj->people_getPublicPhotos($user['id'], NULL, NULL, 4);
foreach ($photos['photos']['photo'] as $photo) {
echo '<a href="' . $user_url . $photo['id'] . '" title="' . $photo['title'] . ' (on Flickr)" target="_blank">';
echo '<img style="border:1px solid" alt="' . $photo['title'] . '" src="' . $phpFlickrObj->buildPhotoURL($photo, "square") . '" />';
echo '</a>';
}
示例13: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$username = esc_attr($instance['username']);
$api_key = esc_attr($instance['api_key']);
$nos = esc_attr($instance['nos']);
echo $before_widget;
include HPATH . "/lib/phpFlickr.php";
if ($title != "") {
echo $before_title . " " . $title . $after_title;
}
if (!$api_key) {
echo '<h4> No API KEY ADDED </h4>';
} else {
$f = new phpFlickr($api_key);
$person = $f->people_findByUsername($username);
$photos_url = $f->urls_getUserPhotos($person['id']);
$photos = $f->people_getPublicPhotos($person['id'], NULL, NULL, 16);
?>
<div class="flickr-pictures clearfix">
<?php
$i = 0;
foreach ((array) $photos['photos']['photo'] as $photo) {
if ($i >= $nos) {
break;
}
$theImageSrc = $f->buildPhotoURL($photo, "thumbnail");
$lb = $f->buildPhotoURL($photo, "large");
echo "<a href='" . $lb . "' class='lightbox' rel='prettyPhoto[pp_gal]' title='{$photo['title']}' ><img src='" . $theImageSrc . "' alt=\"" . $photos_url . $photo["id"] . "\" title='' /></a>";
$i++;
}
?>
</div>
<?php
}
echo $after_widget;
}
示例14: phpFlickr
<?php
require_once "phpFlickr/phpFlickr.php";
$f = new phpFlickr("44449d9d74ed80abe095ab2a6f137dbe", "abde3a1309b8d8e1");
/*
$f->enableCache(
"db",
"mysql://[username]:[password]@[server]/[database]"
);
*/
$photos_url = $f->urls_getUserPhotos('28973605@N00');
$photos = $f->people_getPublicPhotos('28973605@N00', NULL, NULL, 11);
$sets = $f->photosets_getList('28973605@N00');
?>
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="./css/reset-min.css" type="text/css" media="screen" />
<link rel="stylesheet" href="./css/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="./css/jquery.lightbox-0.5.css" type="text/css" media="screen" />
<title>上禾友</title>
<script type="text/javascript" src="./js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="./js/jquery.lightbox-0.5.min.js"></script>
<script type="text/javascript">
(function() {
$(document).ready(function() {
$('#gallery a').lightBox({fixedNavigation:true});
$('.setBox a.more').click(function() {
alert($(this).attr('set_id'));
return false;
示例15: array
function generate_content(&$title)
{
global $serendipity;
$title = $this->get_config('title');
$username = $this->get_config('email');
$num = $this->get_config('perpage');
$choices = $this->get_config('numberOfChoices');
//added 110730 by artodeto
$useChoices = $this->get_config('useChoices');
//added 110730 by artodeto
$apiKey = $this->get_config('apikey');
$apiSecret = $this->get_config('apisecret');
$sourceimgtype = $this->get_config('sourceimgtype');
$targetimgtype = $this->get_config('targetimgtype');
$errors = array();
/* Get image data from flickr */
$f = new phpFlickr($apiKey, $apiSecret);
$f->enableCache("fs", $serendipity['serendipityPath'] . 'templates_c/', $this->get_config('cachetimeout'));
if (stristr($username, '@')) {
$nsid = $f->people_findByEmail($username);
} else {
$nsid = $f->people_findByUsername($username);
}
if ($nsid === false) {
$errors[] = PLUGIN_SIDEBAR_FLICKR_ERROR_WRONGUSER;
}
/* Can't find user */
$photos_url = $f->urls_getUserPhotos($nsid['nsid']);
if ($useChoices === true) {
$photos = $f->photos_search(array("user_id" => $nsid['nsid'], "per_page" => $choices, "sort" => "date-posted-desc", "extras" => "date_taken"));
} else {
$photos = $f->photos_search(array("user_id" => $nsid['nsid'], "per_page" => $num, "sort" => "date-posted-desc", "extras" => "date_taken"));
}
if ($photos[total] > 0 && $f) {
$sizelist = array("0" => "Square", "1" => "Thumbnail", "2" => "Small", "3" => "Medium", "4" => "Large", "5" => "Original");
if ($useChoices === true) {
//added 110730 by artodeto
shuffle($photos['photo']);
array_splice($photos['photo'], $num);
}
foreach ($photos['photo'] as $photo) {
if ($photo['ispublic'] !== 1) {
continue;
}
$imgdate = strftime("%d.%m.%y %H:%M", strtotime($photo['datetaken']));
$imgtitle = $photo['title'];
/* Choose available image size */
$sizes_available = $f->photos_getSizes($photo[id]);
$photosize = $sourceimgtype;
$imgsrcdata = NULL;
while ($imgsrcdata == NULL && $photosize >= 0) {
$imgsrcdata = getsizedata($sizes_available, $sizelist[$photosize]);
$photosize--;
}
/* If updating from previous versions, $targetimgtype could be -1. So we set it to the next legal value 2. */
$photosize = max($targetimgtype, 2);
$imgtrgdata = NULL;
while ($imgtrgdata == NULL && $photosize >= 0) {
$imgtrgdata = getsizedata($sizes_available, $sizelist[$photosize]);
$photosize--;
}
$img_width = $imgsrcdata['width'];
$img_height = $imgsrcdata['height'];
$img_url = $imgsrcdata['source'];
if ($this->get_config('targetlink') == "JPG") {
$link_url = $imgtrgdata['source'];
} else {
$link_url = $imgtrgdata['url'];
}
if ($this->get_config('showdate') || $this->get_config('showtitle')) {
unset($info);
if ($this->get_config('showdate')) {
$info .= '<span class="serendipity_plugin_flickr_date">' . $imgdate . '</span>';
}
if ($this->get_config('showtitle')) {
$info .= '<span class="serendipity_plugin_flickr_title">' . $imgtitle . '</span>';
}
if ($this->get_config('lightbox') != '') {
$lightbox = 'rel="' . $this->get_config('lightbox') . '" ';
}
$images .= sprintf('<dd style="width:%spx;"><a %shref="%s" ><img src="%s" width="%s" height="%s" title="%s" alt="%s"/></a></dd><dt style="width:%spx;margin-left:-%spx;">%s</dt>' . "\n", $img_width, $lightbox, $link_url, $img_url, $img_width, $img_height, $photo[title], $photo[title], $img_width, $img_width + 5, $info);
} else {
$images .= sprintf('<dd style="width:%spx;"><a href="%s"><img src="%s" width="%s" height="%s" alt="%s"/></a></dd>' . "\n", $img_width, $link_url, $img_url, $img_width, $img_height, $photo[title]);
}
$i++;
}
} else {
$errors[] = PLUGIN_SIDEBAR_FLICKR_ERROR_NOIMG;
/* No images available */
}
$content = '<dl class="serendipity_plugin_flickr">' . "\n";
$content .= "\n" . $images;
$content .= '</dl>';
$footer = array();
if ($this->get_config('showrss')) {
$rssicon = serendipity_getTemplateFile('img/xml.gif');
$footer[] = '<a class="serendipity_xml_icon" href="http://api.flickr.com/services/feeds/photos_public.gne?id=' . $nsid['nsid'] . '&format=rss_200"><img src="' . $rssicon . '" alt="XML" style="border: 0px" /></a>' . "\n" . '<a href="http://api.flickr.com/services/feeds/photos_public.gne?id=' . $nsid['nsid'] . '&format=rss_200">' . PLUGIN_SIDEBAR_FLICKR_LINK_SHOWRSS . '</a>';
}
if ($this->get_config('showphotostream')) {
$footer[] = '<a href="http://www.flickr.com/photos/' . $username . '/">' . PLUGIN_SIDEBAR_FLICKR_LINK_PHOTOSTREAM . '</a>';
//.........这里部分代码省略.........