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


PHP phpFlickr::sync_upload方法代码示例

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


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

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

示例2: while

    $token = $f->auth_getToken($frob);
    echo "PLEASE SET THE TOKEN VALUE TO THE TOKEN MENTIONED BELOW, SAVE, AND RERUN THE APPLICATION:";
    echo print_r($token) . "\n\n\n";
} else {
    $f->setToken($token);
    echo "ENTERING MASTER LOOP\n";
    while (1) {
        echo "I'm awake!!!\n";
        $filenames_to_upload = array();
        if ($handle = opendir($read_directory)) {
            while (($file = readdir($handle)) !== false) {
                echo "NEW FILE: {$file} \n\n";
                array_push($filenames_to_upload, $file);
            }
            closedir($handle);
        }
        foreach ($filenames_to_upload as $filename) {
            if ($filename != "." && $filename != "..") {
                echo "PROCESSING {$filename} \n";
                $ticket = $f->sync_upload($read_directory . $filename, $title, $desc, $tags);
                echo "UPLOADED TO FLICKR! NOW MOVING\n";
                rename($read_directory . $filename, $write_directory . $filename);
                echo "MOVED!\n\n";
                sleep(1);
            }
        }
        $filenames_to_upload = array();
        echo "Sleeping....\n\n\n";
        sleep(5);
    }
}
开发者ID:skeevis,项目名称:phpflickrsync,代码行数:31,代码来源:flickrsync.php


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