minz / laravel-qiniu-dora
laravel qiniu dora library
1.0.1
2019-11-28 12:36 UTC
Requires
- php: ^7.0
- qiniu/php-sdk: ^7.2.9
This package is auto-updated.
Last update: 2025-03-29 00:37:10 UTC
README
qiniu dora for Laravel based on qiniu/php-sdk.
Requirement
- PHP >= 7.0
Installing
$ composer require "minz/laravel-qiniu-dora" -vvv
Configuration
- 1.After installing the library, add the follow code to your
config/app.php
file:
'providers' => [ ...... Minz\Laravel\Qiniu\OSS\QiniuDoraServiceProvider::class, ], 'aliases' => [ ...... 'Dora' => Minz\Laravel\Qiniu\Dora\QiniuDoraFacade::class, ],
Laravel 5.5+ skip
- 2.publish config file
config/qiniuDora.php
php artisan vendor:publish --provider="Minz\Laravel\Qiniu\Dora\QiniuDoraServiceProvider"
- 3.Add .env params to your
.env
file
QINIU_ACCESS_KEY=your qiniu access key QINIU_SECRET_KEY=your qiniu secret key QINIU_BUCKET=your qiniu bucket name QINIU_PIPELINE=your qiniu pipeline
Usage
qiniu dira 七牛智能多媒体服务开发者文档
qiniu/php-sdk 七牛PHP SDK
- Api document
/** * 对资源文件进行异步持久化处理 * * @param string $fileKey 存储于bucket中的资源key * @param $fops string|array 待处理的pfop操作,多个pfop操作以array的形式传入。 * eg. avthumb/mp3/ab/192k, vframe/jpg/offset/7/w/480/h/360 * @param string|null $pipeline 多媒体队列名称,默认使用配置文件 * @param string|null $notifyUrl 回调服务器地址 * @param bool $force 如果key相同是否强制覆盖object 默认为false * @return array (返回持久化处理的persistentId, 返回的错误) */ public function execute(string $fileKey, $fops, string $pipeline = null, string $notifyUrl = null, bool $force = false)
- use
#打水印图片公共读地址 $imgUrl = "http:yourPictireUrl"; #七牛kodo资源名称 $fileKey = "demo.wmv"; #打水印后视频另存为地址 必须为 bucket:saveKey base64Encode $videoSaveKey = config('qiniuDora.bucket') . ":" . "yourVideoSaveKey"; #截取视频某个帧另存为图片 必须为 bucket:saveKey base64Encode $pictureSaveKey = config('qiniuDora.bucket') . ":" . "yourPictureSaveKey"; //格式请参考七牛dora api 文档 $fops = [ "avthumb/mp4/r/15/vb/256k/vcodec/libx264/ab/64k/acodec/libfaac/wmImage/" . base64_encode($imgUrl) . "|saveas/" . base64_encode($videoSaveKey), "vframe/jpg/offset/5|saveas/" . base64_encode($pictureSaveKey) ]; list($id, $err) = Dora::execute($fileKey, $fops);
depend
License
MIT