本文整理汇总了PHP中phpFlickr::getErrorMsg方法的典型用法代码示例。如果您正苦于以下问题:PHP phpFlickr::getErrorMsg方法的具体用法?PHP phpFlickr::getErrorMsg怎么用?PHP phpFlickr::getErrorMsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpFlickr
的用法示例。
在下文中一共展示了phpFlickr::getErrorMsg方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: phpFlickr
require_once "lib/phpFlickr/phpFlickr.php";
$f = new phpFlickr("", NULL, false);
if ($this->attributes['details']['show'] == "automatic") {
if (empty($this->attributes['details']['query']) && empty($this->attributes['details']['text'])) {
print "No search terms were entered.";
} else {
if ($this->attributes['details']['searchtype'] == 'tags') {
$photos = $f->photos_search(array("tags" => $this->attributes['details']['query'], "tag_mode" => $this->attributes['details']['boolean'], "extras" => "owner_name", "per_page" => $this->attributes['details']['max_photos']));
} else {
if ($this->attributes['details']['searchtype'] == 'text') {
$tags = trim($this->attributes['details']['tags']);
$photos = $f->photos_search(array("text" => $tags, "extras" => "owner_name", "per_page" => $this->attributes['details']['max_photos']));
}
}
$isError = $f->getErrorMsg();
if (!$isError && isset($photos['photo']) && count($photos['photo']) > 0) {
echo "<table cellpadding='3' style='border: none; width: 100%'>\n<tr>";
foreach ($photos['photo'] as $key => $photo) {
?>
<td style="vertical-align: top; text-align: center; width: 33%">
<a href="http://www.flickr.com/photos/<?php
echo $photo['owner'];
?>
/<?php
echo $photo['id'];
?>
">
<img style="padding: 1px; border: 1px solid black;" alt="<?php
echo $photo['title'] . " by " . $photo['ownername'];
?>
示例3: uploadImage
/**
* Accept a request to upload an image either via POST data (user upload)
* or via flickr or google / wikimedia.org search.
*
* @param $src string with value 'upload', 'flickr' or 'wiki'
* @return html outputs image details page
*/
private function uploadImage($src, $fromIIA = false)
{
global $wgRequest, $wgUser, $IP, $wgOut;
$error = '';
$debugInfo = array();
if ($src == 'upload') {
$tempname = TempLocalFile::createTempFilename();
$file = new TempLocalFile(Title::newFromText($tempname, NS_IMAGE), RepoGroup::singleton()->getLocalRepo());
$name = $wgRequest->getFileName('wpUploadFile');
$file->upload($wgRequest->getFileTempName('wpUploadFile'), '', '');
$comment = '';
$filesize = $file->getSize();
if (!$filesize) {
$error = wfMsg('eiu-upload-error');
}
} elseif ($fromIIA || $src == 'flickr' || $src == 'wiki') {
$sourceName = $fromIIA || $src == 'flickr' ? 'Flickr' : 'Mediawiki Commons';
$tempname = TempLocalFile::createTempFilename();
$file = new TempLocalFile(Title::newFromText($tempname, NS_IMAGE), RepoGroup::singleton()->getLocalRepo());
$details = (array) json_decode($wgRequest->getVal('img-details'));
$name = $details['name'];
// scrape the file using curl
$filename = '/tmp/tmp-curl-' . mt_rand(0, 100000000) . '.jpg';
$remoteFile = strlen($details['url_l']) ? $details['url_l'] : $details['url'];
$ch = curl_init($remoteFile);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$fp = fopen($filename, 'w');
curl_setopt($ch, CURLOPT_FILE, $fp);
$ret = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
fclose($fp);
if ($err) {
$debugInfo['curl'] = $err;
}
$filesize = @filesize($filename);
if ($filesize) {
if ($fromIIA || $src == 'flickr' || preg_match('@^http://[^/]*flickr@', $details['url'])) {
require_once $IP . '/extensions/3rdparty/phpFlickr-2.3.1/phpFlickr.php';
$flickr = new phpFlickr(WH_FLICKR_API_KEY);
$photo = $flickr->photos_getInfo($details['photoid']);
$err = $flickr->getErrorMsg();
if ($err) {
$debugInfo['flickrAPI'] = $err;
}
$license = $photo['license'];
$username = $photo['owner']['username'];
$comment = '{{flickr' . intval($license) . '|' . wfEscapeWikiText($details['photoid']) . '|' . wfEscapeWikiText($details['ownerid']) . '|' . wfEscapeWikiText($username) . '}}';
} else {
$comment = self::getWPLicenseTag($details['url']);
}
// finish initializing the $file obj
$status = $file->upload($filename, '', '');
if (!$status->ok) {
$error = wfMsg('eiu-upload-error');
}
} else {
$error = wfMsg('eiu-download-error', $sourceName);
}
}
if ($error) {
$html = EasyTemplate::html('eiu_file_error.tmpl.php', array('error' => $error));
$wgOut->addHTML($html);
error_log("file from {$src} error msgs: " . print_r($debugInfo, true));
} else {
$mwname = $tempname;
if (!$fromIIA) {
$props = array('src' => $src, 'name' => $name, 'mwname' => $mwname, 'is_image' => $file->media_type == 'BITMAP' || $file->media_type == 'DRAWING', 'width' => $file->width, 'height' => $file->height, 'upload_file' => $file, 'image_comment' => $comment, 'license' => $wgUser->getOption('image_license'));
$html = EasyTemplate::html('eiu_image_details.tmpl.php', $props);
$wgOut->addHTML($html);
} else {
$this->insertImage('', $name, $mwname, true, $comment);
}
}
}
示例4: 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.
*
* 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("3077891bafd02f95795c02a20be57144");
$recent = $f->people_getPublicPhotos('31446365@N05', null, null, 2);
$photos = array();
if (empty($recent)) {
echo $f->getErrorMsg();
} else {
foreach ($recent['photos']['photo'] as $photo) {
$photos[] = array('s' => $f->buildPhotoURL($photo, 'square'), 'o' => $f->buildPhotoURL($photo, 'original'), 'title' => $photo['title']);
}
}
示例5: 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());
}
if (count((array) $photos[$photos_main_index]['photo']) == 0) {
示例6: 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());
}
$photos_pool = $photos[$photos_main_index];
示例7: flickrsync_vardump
}
function flickrsync_vardump($var)
{
ob_start();
var_dump($var);
flickrsync_log_mesmo(ob_get_clean());
}
flickrsync_log('iniciando');
$f = new phpFlickr(FLICKR_API_KEY, FLICKR_API_SECRET);
flickrsync_log('instanciado');
$f->setToken(FLICKR_API_AUTH_TOKEN);
flickrsync_log('setado token');
$f->auth();
flickrsync_log('autenticado');
//change this to the permissions you will need
// $f->auth("read");
//echo "Copy this token into your code: " . $_SESSION['phpFlickr_auth_token'];
echo 'listanddo flickr';
//Parameterless searches have been disabled. Please use flickr.photos.getRecent instead.
$photos = $f->photos_search(array('user_id' => FLICKR_USER_ID));
//$photos = $this->phpFlickr->photos_getRecent();
if (false === $photos) {
print_r($f->getErrorCode());
echo "\n";
print_r($f->getErrorMsg());
echo "\n";
}
var_dump($photos);
print_r($photos);
echo ob_get_clean();
exit;