File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ require_once __DIR__ . '/../autoload.php ' ;
3+
4+ use Qiniu \Auth ;
5+ use Qiniu \Processing \PersistentFop ;
6+
7+ $ accessKey = 'Access_Key ' ;
8+ $ secretKey = 'Secret_Key ' ;
9+ $ auth = new Auth ($ accessKey , $ secretKey );
10+
11+ //要持久化处理的文件所在的空间和文件名。
12+ $ bucket = 'Bucket_Name ' ;
13+
14+ //持久化处理使用的队列名称。 https://portal.qiniu.com/mps/pipeline
15+ $ pipeline = 'pipeline_name ' ;
16+
17+ //持久化处理完成后通知到你的业务服务器。
18+ $ notifyUrl = 'http://375dec79.ngrok.com/notify.php ' ;
19+ $ pfop = new PersistentFop ($ auth , $ bucket , $ pipeline , $ notifyUrl );
20+
21+ $ id = "z2.5955c739e3d0041bf80c9baa " ;
22+ //查询持久化处理的进度和状态
23+ list ($ ret , $ err ) = $ pfop ->status ($ id );
24+ echo "\n====> pfop avthumb status: \n" ;
25+ if ($ err != null ) {
26+ var_dump ($ err );
27+ } else {
28+ var_dump ($ ret );
29+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ require_once __DIR__ . '/../autoload.php ' ;
3+
4+ use Qiniu \Auth ;
5+ use Qiniu \Processing \PersistentFop ;
6+
7+ // 后台来获取AK, SK
8+ $ accessKey = 'Access_Key ' ;
9+ $ secretKey = 'Secret_Key ' ;
10+
11+ //生成EncodedEntryURI的值
12+ $ entry ='<bucket>:<Key> ' ;//<Key>为生成缩略图的文件名
13+ //生成的值
14+ $ encodedEntryURI =\Qiniu \base64_urlSafeEncode ($ entry );
15+
16+ //使用SecretKey对新的下载URL进行HMAC1-SHA1签名
17+ $ newurl = "78re52.com1.z0.glb.clouddn.com/resource/Ship.jpg?imageView2/2/w/200/h/200|saveas/ " .$ encodedEntryURI ;
18+
19+ $ sign = hash_hmac ("sha1 " , $ newurl , $ secretKey , true );
20+
21+ //对签名进行URL安全的Base64编码
22+ $ encodedSign = \Qiniu \base64_urlSafeEncode ($ sign );
23+ //最终得到的完整下载URL
24+ $ finalURL = "http:// " .$ newurl ."/sign/ " .$ accessKey .": " .$ encodedSign ;
25+
26+ $ callbackBody = file_get_contents ("$ finalURL " );
27+
28+ echo $ callbackBody ;
You can’t perform that action at this time.
0 commit comments