• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP phpFlickr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ws_images_addFlickr

function ws_images_addFlickr($photo, &$service)
{
    if (!is_admin()) {
        return new PwgError(403, 'Forbidden');
    }
    global $conf;
    if (empty($conf['flickr2piwigo']['api_key']) or empty($conf['flickr2piwigo']['secret_key'])) {
        return new PwgError(null, l10n('Please fill your API keys on the configuration tab'));
    }
    include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
    include_once PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php';
    include_once FLICKR_PATH . 'include/functions.inc.php';
    if (test_remote_download() === false) {
        return new PwgError(null, l10n('No download method available'));
    }
    // init flickr API
    include_once FLICKR_PATH . 'include/phpFlickr/phpFlickr.php';
    $flickr = new phpFlickr($conf['flickr2piwigo']['api_key'], $conf['flickr2piwigo']['secret_key']);
    $flickr->enableCache('fs', FLICKR_FS_CACHE);
    // user
    $u = $flickr->test_login();
    if ($u === false or empty($_SESSION['phpFlickr_auth_token'])) {
        return new PwgError(403, l10n('API not authenticated'));
    }
    // photos infos
    $photo_f = $flickr->photos_getInfo($photo['id']);
    $photo = array_merge($photo, $photo_f['photo']);
    $photo['url'] = $flickr->get_biggest_size($photo['id'], 'original');
    $photo['path'] = FLICKR_FS_CACHE . 'flickr-' . $u['username'] . '-' . $photo['id'] . '.' . get_extension($photo['url']);
    // copy file
    if (download_remote_file($photo['url'], $photo['path']) == false) {
        return new PwgError(null, l10n('Can\'t download file'));
    }
    // category
    if (!preg_match('#^[0-9]+$#', $photo['category'])) {
        $categories_names = explode(',', $photo['category']);
        $photo['category'] = array();
        foreach ($categories_names as $category_name) {
            $query = '
SELECT id FROM ' . CATEGORIES_TABLE . '
  WHERE LOWER(name) = "' . strtolower($category_name) . '"
;';
            $result = pwg_query($query);
            if (pwg_db_num_rows($result)) {
                list($cat_id) = pwg_db_fetch_row($result);
                $photo['category'][] = $cat_id;
            } else {
                $cat = create_virtual_category($category_name);
                $photo['category'][] = $cat['id'];
            }
        }
    } else {
        $photo['category'] = array($photo['category']);
    }
    // add photo
    $photo['image_id'] = add_uploaded_file($photo['path'], basename($photo['path']), $photo['category']);
    // do some updates
    if (!empty($photo['fills'])) {
        $photo['fills'] = rtrim($photo['fills'], ',');
        $photo['fills'] = explode(',', $photo['fills']);
        $updates = array();
        if (in_array('fill_name', $photo['fills'])) {
            $updates['name'] = pwg_db_real_escape_string($photo['title']);
        }
        if (in_array('fill_posted', $photo['fills'])) {
            $updates['date_available'] = date('Y-m-d H:i:s', $photo['dates']['posted']);
        }
        if (in_array('fill_taken', $photo['fills'])) {
            $updates['date_creation'] = $photo['dates']['taken'];
        }
        if (in_array('fill_author', $photo['fills'])) {
            $updates['author'] = pwg_db_real_escape_string($photo['owner']['username']);
        }
        if (in_array('fill_description', $photo['fills'])) {
            $updates['comment'] = pwg_db_real_escape_string(@$photo['description']);
        }
        if (in_array('fill_geotag', $photo['fills']) and !empty($photo['location'])) {
            $updates['latitude'] = pwg_db_real_escape_string($photo['location']['latitude']);
            $updates['longitude'] = pwg_db_real_escape_string($photo['location']['longitude']);
        }
        if (in_array('level', $photo['fills']) && !$photo['visibility']['ispublic']) {
            $updates['level'] = 8;
            if ($photo['visibility']['isfamily']) {
                $updates['level'] = 4;
            }
            if ($photo['visibility']['isfriend']) {
                $updates['level'] = 2;
            }
        }
        if (count($updates)) {
            single_update(IMAGES_TABLE, $updates, array('id' => $photo['image_id']));
        }
        if (!empty($photo['tags']['tag']) and in_array('fill_tags', $photo['fills'])) {
            $raw_tags = array_map(create_function('$t', 'return $t["_content"];'), $photo['tags']['tag']);
            $raw_tags = implode(',', $raw_tags);
            set_tags(get_tag_ids($raw_tags), $photo['image_id']);
        }
    }
    return l10n('Photo "%s" imported', $photo['title']);
}
开发者ID:biffhero,项目名称:Flickr2Piwigo,代码行数:100,代码来源:ws_functions.inc.php


示例2: nextend_api_auth_flow

function nextend_api_auth_flow()
{
    $api_key = NextendRequest::getVar('api_key');
    $api_secret = NextendRequest::getVar('api_secret');
    if (session_id() == "") {
        @session_start();
    }
    if (!$api_key || !$api_secret) {
        $api_key = isset($_SESSION['api_key']) ? $_SESSION['api_key'] : null;
        $api_secret = isset($_SESSION['api_secret']) ? $_SESSION['api_secret'] : null;
    } else {
        $_SESSION['api_key'] = $api_key;
        $_SESSION['api_secret'] = $api_secret;
    }
    if ($api_key && $api_secret) {
        require_once dirname(__FILE__) . "/api/phpFlickr.php";
        $f = new phpFlickr($api_key, $api_secret);
        if (empty($_GET['frob'])) {
            $f->auth('read', false);
        } else {
            $result = $f->auth_getToken($_GET['frob']);
            unset($_SESSION['api_key']);
            unset($_SESSION['api_secret']);
            unset($_SESSION['phpFlickr_auth_token']);
            echo '<script type="text/javascript">';
            echo 'window.opener.setToken("' . $result['token'] . '");';
            echo '</script>';
        }
    }
}
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:30,代码来源:auth.php


示例3: getValidation

 function getValidation($username, $apiKey, $secretKey)
 {
     $this->loadPhpFlickrClasses();
     $service = new phpFlickr($apiKey, $secretKey);
     $nsid = $service->people_findByUsername($username);
     return $nsid;
 }
开发者ID:sangkasi,项目名称:joomla,代码行数:7,代码来源:jsn_is_flickr.php


示例4: searchFlickrPhotoDetail

function searchFlickrPhotoDetail($id, $type)
{
    $retval = array();
    $data = array();
    $f = new phpFlickr('5bc169cff7b9121c0c93f9b8804b1116');
    $photo = $f->photos_getInfo($id);
    $tags = '';
    foreach ($photo['tags']['tag'] as $tag) {
        $tags .= $tag['raw'] . ',';
        //$tag['raw']
    }
    $notes = array();
    foreach ($photo['notes']['note'] as $note) {
        $notes[] = $note['_content'];
    }
    $urls = array();
    foreach ($photo['urls']['url'] as $url) {
        $urls = $url['_content'];
    }
    $data = array('title' => $photo['title'], 'description' => $photo['description'], 'image' => $f->buildPhotoURL($photo), 'date' => $photo['dates']['taken'], 'author' => $photo['owner']['username'], 'authorUrl' => 'http://flickr.com/photos/' . $photo['owner']['nsid'], 'tags' => $tags, 'note' => $notes, 'url' => $urls);
    $retval['status'] = 'OK';
    $retval['statusmsg'] = 'OK';
    $retval['data'] = $data;
    return $retval;
}
开发者ID:uhdyi,项目名称:blacklist,代码行数:25,代码来源:FlickrService.php


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


示例6: onNextendFlickr

 function onNextendFlickr(&$flickr)
 {
     $config = new NextendData();
     $config->loadJson(NextendSmartSliderStorage::get(self::$_group));
     require_once dirname(__FILE__) . "/api/phpFlickr.php";
     $flickr = new phpFlickr($config->get('apikey', ''), $config->get('apisecret', ''));
     $flickr->setToken($config->get('token', ''));
 }
开发者ID:AndyHuntDesign,项目名称:andyhuntdesign,代码行数:8,代码来源:flickr.php


示例7: flickrUser

function flickrUser($userName)
{
    global $site;
    $f = new phpFlickr($site["flickr"]["key"]);
    $f->enableCache("fs", $site["path"] . $site["folder"] . $site["flickr"]["cache"], $site["flickr"]["cacheduration"]);
    $user = $f->people_findByUsername($userName);
    return $user;
}
开发者ID:ntctbt,项目名称:LoremFlickr,代码行数:8,代码来源:functions.php


示例8: flickr_show_set

function flickr_show_set($set_id, $size = 's', $start = 0, $limit = 0, $bigsize = '')
{
    global $FLICKR_API_KEY;
    $f = new phpFlickr($FLICKR_API_KEY);
    $set = $f->photosets_getPhotos($set_id);
    $start = $start;
    $limit = $limit > 0 ? $limit : count($set['photo']);
    flickr_output_from_set($set, $size, $start, $limit, $bigsize);
}
开发者ID:andyinabox,项目名称:mnkino,代码行数:9,代码来源:flickr.php


示例9: uploadPhoto

function uploadPhoto($path, $title)
{
    $apiKey = "3b7d4ab3e54988c4e6fd59d9e40ca28c";
    $apiSecret = "84d2e480c8e3c926";
    $permissions = "write";
    $token = "72157626228984291-4635fa88a6fed8f5";
    $f = new phpFlickr($apiKey, $apiSecret, true);
    $f->setToken($token);
    return $f->async_upload($path, $title);
}
开发者ID:ravikiranj,项目名称:flickr-photo-uploader,代码行数:10,代码来源:index.php


示例10: upload_photo

function upload_photo($path, $title)
{
    $apiKey = "your-flickr-key";
    $apiSecret = "your-flickr-secret";
    $token = "flickr-token";
    $permissions = "write";
    $f = new phpFlickr($apiKey, $apiSecret, true);
    $f->setToken($token);
    $f->async_upload($path, $title);
    @unlink("temp.jpg");
}
开发者ID:peter279k,项目名称:store_photo,代码行数:11,代码来源:new_photo_detect.php


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


示例12: 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;
 }
开发者ID:eyedol,项目名称:flickr_viewer,代码行数:36,代码来源:get_flickr_images.php


示例13: uploadPhoto

function uploadPhoto($path, $title)
{
    $apiKey = "e0fb27a9db978169247afe3169afba43";
    $apiSecret = "d9a3f7d933ae7ccf";
    $permissions = "write";
    $token = "72157662014557483-df831fa3afbc5468";
    $f = new phpFlickr($apiKey, $apiSecret, true);
    $f->setToken($token);
    $result = $f->sync_upload($path, $title);
    $photo = $f->photos_getInfo($result);
    print_r($photo);
    $src = 'http://farm' . $photo['photo']['farm'] . '.staticflickr.com/' . $photo['photo']['server'] . '/' . $photo['photo']['id'] . '_' . $photo['photo']['secret'] . '.' . $photo['photo']['originalformat'];
    $src = 'https://c1.staticflickr.com/' . $photo['photo']['farm'] . '/' . $photo['photo']['server'] . '/' . $photo['photo']['id'] . '_' . $photo['photo']['secret'] . '_n.jpg';
    echo '<br><img src="' . $src . '">';
}
开发者ID:muthugit,项目名称:flickrPhotoUpload,代码行数:15,代码来源:upload.php


示例14: 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;
}
开发者ID:ntnvu,项目名称:tcb_online,代码行数:16,代码来源:flickr-widget.php


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


示例16: getFlickrConnection

function getFlickrConnection()
{
    if (FLICKR_KEY) {
        $flickr = new phpFlickr(FLICKR_KEY);
        if (false !== $flickr->test_echo()) {
            $cache = dirname(__FILE__) . '/cache';
            if (file_exists($cache)) {
                $flickr->enableCache("fs", $cache);
            }
            return $flickr;
        } else {
            throw new \RuntimeException('Flickr API Key has been defined but is invalid.');
        }
    } else {
        throw new \RuntimeException('Flickr API Key has not been defined.');
    }
}
开发者ID:ncstate,项目名称:social-sdk,代码行数:17,代码来源:flickr.php


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


示例18: 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_V1.php


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


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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP phpFreeChat类代码示例发布时间:2022-05-23
下一篇:
PHP phpFastCache类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap