Esempio n. 1
0
 public function testMkzip()
 {
     global $testAuth;
     $pfop = new PersistentFop($testAuth, 'testres', 'sdktest', true);
     $urls = array('http://testres.qiniudn.com/gogopher.jpg' => 'g.jpg', 'http://testres.qiniudn.com/gogopher.jpg');
     list($id, $error) = $pfop->mkzip('sintel_trailer.mp4', $urls, 'phpsdk', 'mkziptest2.zip');
     $this->assertNull($error);
     list($status, $error) = PersistentFop::status($id);
     $this->assertNotNull($status);
     $this->assertNull($error);
 }
Esempio n. 2
0
 public function testExecute2()
 {
     global $testAuth;
     $bucket = 'testres';
     $key = 'sintel_trailer.mp4';
     $fops = array('avthumb/m3u8/segtime/10/vcodec/libx264/s/320x240', 'vframe/jpg/offset/7/w/480/h/360');
     $pfop = new PersistentFop($testAuth, $bucket);
     list($id, $error) = $pfop->execute($key, $fops);
     $this->assertNull($error);
     list($status, $error) = PersistentFop::status($id);
     $this->assertNotNull($status);
     $this->assertNull($error);
 }
Esempio n. 3
0
 public function testMkzip()
 {
     global $testAuth;
     $bucket = 'phpsdk';
     $key = 'php-logo.png';
     $pfop = new PersistentFop($testAuth, $bucket);
     $url1 = 'http://phpsdk.qiniudn.com/php-logo.png';
     $url2 = 'http://phpsdk.qiniudn.com/php-sdk.html';
     $zipKey = 'test.zip';
     $fops = 'mkzip/2/url/' . \Qiniu\base64_urlSafeEncode($url1);
     $fops .= '/url/' . \Qiniu\base64_urlSafeEncode($url2);
     $fops .= '|saveas/' . \Qiniu\base64_urlSafeEncode("{$bucket}:{$zipKey}");
     list($id, $error) = $pfop->execute($key, $fops);
     $this->assertNull($error);
     list($status, $error) = PersistentFop::status($id);
     $this->assertNotNull($status);
     $this->assertNull($error);
 }
Esempio n. 4
0
 /**
  * 查询异步持久化处理的进度和状态
  * @param $id 触发持久化处理后返回的 Id
  * @return array
  */
 public function persistentStatus($id)
 {
     return PersistentFop::status($id);
 }
Esempio n. 5
0
//对已经上传到七牛的视频发起异步转码操作
$accessKey = 'Access_Key';
$secretKey = 'Secret_Key';
$auth = new Auth($accessKey, $secretKey);
//要转码的文件所在的空间和文件名。
$bucket = 'Bucket_Name';
$key = 'File_Name_On_Qiniu';
//转码是使用的队列名称。 https://portal.qiniu.com/mps/pipeline
$pipeline = 'pipeline_name';
//转码完成后通知到你的业务服务器。
$notifyUrl = 'http://375dec79.ngrok.com/notify.php';
$pfop = new PersistentFop($auth, $bucket, $pipeline, $notifyUrl);
//需要添加水印的图片UrlSafeBase64,可以参考http://developer.qiniu.com/code/v6/api/dora-api/av/video-watermark.html
$base64URL = Qiniu\base64_urlSafeEncode('http://developer.qiniu.com/resource/logo-2.jpg');
//水印参数
$fops = "avthumb/mp4/s/640x360/vb/1.4m/image/" . $base64URL;
list($id, $err) = $pfop->execute($key, $fops);
echo "\n====> pfop avthumb result: \n";
if ($err != null) {
    var_dump($err);
} else {
    echo "PersistentFop Id: {$id}\n";
}
//查询转码的进度和状态
list($ret, $err) = $pfop->status($id);
echo "\n====> pfop avthumb status: \n";
if ($err != null) {
    var_dump($err);
} else {
    var_dump($ret);
}
Esempio n. 6
0
function qiniu_get_pfop_status($id)
{
    return \Qiniu\Processing\PersistentFop::status($id);
}
Esempio n. 7
0
 /**
  * @param $id
  * @return mixed
  */
 public function fopStatus($id)
 {
     return $this->response(PersistentFop::status($id));
 }
<?php

require_once __DIR__ . '/../autoload.php';
use Qiniu\Processing\PersistentFop;
// 触发持久化处理后返回的 Id
$persistentId = 'z0.564d5f977823de48a85ece59';
// 通过persistentId查询该 触发持久化处理的状态
$status = PersistentFop::status($persistentId);
var_dump($status);