Skip to content

Commit 1de7a5c

Browse files
committed
add filter in fop an pfop
1 parent a1569da commit 1de7a5c

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

src/Qiniu/Processing/Operation.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,28 @@ public function buildUrl($key, $cmd, $mod = null, array $args = array())
4949
return $url;
5050
}
5151

52+
private static $fops = array(
53+
'imageView2',
54+
'imageMogr2',
55+
'imageInfo',
56+
'exif',
57+
'watermark',
58+
'imageAve',
59+
60+
'avinfo',
61+
'pm3u8',
62+
63+
'qrcode',
64+
'md2html',
65+
);
66+
5267
public function __call($method, $args)
5368
{
69+
70+
if (!in_array($method, self::$fops)) {
71+
throw new \InvalidArgumentException("fop {$method} isn't supported");
72+
}
5473
$key = $args[0];
55-
$cmd = $method;
5674
$mode = null;
5775
if (count($args)>1) {
5876
$mode = $args[1];
@@ -62,7 +80,7 @@ public function __call($method, $args)
6280
$options = $args[2];
6381
}
6482
$options = array();
65-
$url = $this->buildUrl($key, $cmd, $mode, $options);
83+
$url = $this->buildUrl($key, $method, $mode, $options);
6684
$r = Client::get($url);
6785
if (!$r->ok()) {
6886
return array(null, new Error($url, $r));

src/Qiniu/Processing/PersistentFop.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,23 @@ public static function status($id)
5858
return array($response->json(), null);
5959
}
6060

61+
private static $pfops = array(
62+
'avthumb',
63+
'vframe',
64+
'segtime',
65+
'vsample',
66+
'vwatermark',
67+
'avconcat',
68+
69+
'concat',
70+
);
71+
6172
public function __call($method, $args)
6273
{
74+
75+
if (!in_array($method, self::$pfops)) {
76+
throw new \InvalidArgumentException("pfop {$method} isn't support");
77+
}
6378
$key = $args[0];
6479
$cmd = $method;
6580
$mod = null;

0 commit comments

Comments
 (0)