Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into abcsun-master

Conflicts:
	src/QiniuAdapter.php
	src/QiniuFilesystemServiceProvider.php
  • Loading branch information
Zhang Wenbin committed Sep 25, 2015
2 parents fe4bc48 + f146b1e commit 15b3d75
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 46 deletions.
55 changes: 20 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,9 @@

## 更新

v0.2 提供了对多域名的支持。这是为了配合七牛的默认域名、HTTPS域名和自定义域名而添加的功能。
您只需要将```config/filesystem.php```文件内您的七牛disk的domain属性稍加调整即可。具体如下:

添加```domains```数组:

```php
'qiniu' => [
'driver' => 'qiniu',
'domains' => [
'default'=>'xxxxx.com1.z0.glb.clouddn.com', //你的七牛默认域名
'https' => 'dn-yourdomain.qbox.me', //你的HTTPS域名
'custom' => 'static.abc.com', //你的自定义域名
],
'access_key' => '', //AccessKey
'secret_key' => '', //SecretKey
'bucket' => '', //Bucket名字
],
```

然后填写好你的七牛默认域名、HTTPS域名和自定义域名即可。 如果没有HTTPS域名和自定义域名,留空即可。
v0.3 增加了对PIPE以及回调地址参数的配置。 感谢abcsun提供的灵感。

v0.2 提供了对多域名的支持。这是为了配合七牛的默认域名、HTTPS域名和自定义域名而添加的功能。

## 安装

Expand All @@ -39,15 +21,16 @@
'disks' => [
... ,
'qiniu' => [
'driver' => 'qiniu',
'driver' => 'qiniu',
'domains' => [
'default'=>'xxxxx.com1.z0.glb.clouddn.com', //你的七牛域名
'https' => 'dn-yourdomain.qbox.me', //你的HTTPS域名
'custom' => 'static.abc.com', //你的自定义域名
'default' => 'xxxxx.com1.z0.glb.clouddn.com', //你的七牛域名
'https' => 'dn-yourdomain.qbox.me', //你的HTTPS域名
'custom' => 'static.abc.com', //你的自定义域名
],
'access_key' => '', //AccessKey
'secret_key' => '', //SecretKey
'bucket' => '', //Bucket名字
'access_key'=> '', //AccessKey
'secret_key'=> '', //SecretKey
'bucket' => '', //Bucket名字
'notify_url'=> '', //持久化处理回调地址
],
],

Expand Down Expand Up @@ -82,14 +65,15 @@

$disk->getDriver()->uploadToken('file.jpg'); //获取上传Token
$disk->getDriver()->downloadUrl('file.jpg'); //获取下载地址
$disk->getDriver()->downloadUrl('file.jpg', 'https'); //获取HTTPS下载地址
$disk->getDriver()->downloadUrl('file.jpg', 'https'); //获取HTTPS下载地址
$disk->getDriver()->privateDownloadUrl('file.jpg'); //获取私有bucket下载地址
$disk->getDriver()->privateDownloadUrl('file.jpg', 'https'); //获取私有bucket的HTTPS下载地址
$disk->getDriver()->privateDownloadUrl('file.jpg', 'https');//获取私有bucket的HTTPS下载地址
$disk->getDriver()->imageInfo('file.jpg'); //获取图片信息
$disk->getDriver()->imageExif('file.jpg'); //获取图片EXIF信息
$disk->getDriver()->imagePreviewUrl('file.jpg','imageView2/0/w/100/h/200'); //获取图片预览URL
$disk->getDriver()->imagePreviewUrl('file.jpg','imageView2/0/w/100/h/200'); //获取图片预览URL
$disk->getDriver()->persistentFop('file.flv','avthumb/m3u8/segtime/40/vcodec/libx264/s/320x240'); //执行持久化数据处理
$disk->getDriver()->persistentStatus($persistent_fop_id); //查看持久化数据处理的状态。
$disk->getDriver()->persistentFop('file.flv','fop','管道名'); //使用私有队列执行持久化数据处理
$disk->getDriver()->persistentStatus($persistent_fop_id); //查看持久化数据处理的状态。

```

Expand Down Expand Up @@ -125,14 +109,15 @@
$disk->privateDownloadUrl('file.jpg', 'https'); //获取私有bucket的HTTPS下载地址
$disk->imageInfo('file.jpg'); //获取图片信息
$disk->imageExif('file.jpg'); //获取图片EXIF信息
$disk->imagePreviewUrl('file.jpg','imageView2/0/w/100/h/200'); //获取图片预览URL
$disk->persistentFop('file.flv','avthumb/m3u8/segtime/40/vcodec/libx264/s/320x240'); //执行持久化数据处理
$disk->persistentStatus($persistent_fop_id); //查看持久化数据处理的状态。
$disk->imagePreviewUrl('file.jpg','imageView2/0/w/100/h/200'); //获取图片预览URL
$disk->persistentFop('file.flv','avthumb/m3u8/segtime/40/vcodec/libx264/s/320x240'); //执行持久化数据处理
$disk->persistentFop('file.flv','fop','管道名'); //使用私有队列执行持久化数据处理
$disk->persistentStatus($persistent_fop_id); //查看持久化数据处理的状态。

```


## 官方SDK / 手册

- https://github.com/qiniu/php-sdk
- http://developer.qiniu.com/docs/v6/sdk/php-sdk.html
- http://developer.qiniu.com/docs/v6/sdk/php-sdk.html
15 changes: 11 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
{
"name": "zgldh/qiniu-laravel-storage",
"name": "abcsun/qiniu-laravel",
"type": "library",
"description": "Qiniu Resource (Cloud) Storage SDK for Laravel 5",
"keywords": ["qiniu", "storage", "sdk", "cloud", "laravel"],
"license": "MIT",
"authors": [
{
"name": "zgldh",
"email": "[email protected]"
}
"name": "zgldh",
"email": "[email protected]",
"role": "Original Developer"
},
{
"name": "abcsun",
"email": "[email protected]",
"role": "Developer",
"homepage": "http://github.com/abcsun"
}
],
"require": {
"php": ">=5.3.3",
Expand Down
4 changes: 2 additions & 2 deletions src/Plugins/PersistentFop.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public function getMethod()
return 'persistentFop';
}

public function handle($path = null, $fops = null)
public function handle($path = null, $fops = null, $pipline = null, $force = false)
{
return $this->filesystem->getAdapter()->persistentFop($path, $fops);
return $this->filesystem->getAdapter()->persistentFop($path, $fops, $pipline, $force);
}
}
8 changes: 5 additions & 3 deletions src/QiniuAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class QiniuAdapter extends AbstractAdapter
private $secret_key = null;
private $bucket = null;
private $domains = null;
private $notify_url = null; //持久化处理后的回调地址

private $auth = null;
private $upload_manager = null;
Expand All @@ -30,7 +31,7 @@ class QiniuAdapter extends AbstractAdapter

private $prefixedDomains = [];

public function __construct($access_key, $secret_key, $bucket, $domains)
public function __construct($access_key, $secret_key, $bucket, $domains,$notify_url = null)
{
$this->access_key = $access_key;
$this->secret_key = $secret_key;
Expand All @@ -40,6 +41,7 @@ public function __construct($access_key, $secret_key, $bucket, $domains)
$this->setDomainPrefix('http://' . $this->domains['default'], 'default');
$this->setDomainPrefix('https://' . $this->domains['https'], 'https');
$this->setDomainPrefix('http://' . $this->domains['custom'], 'custom');
$this->notify_url = $notify_url;
}

/**
Expand Down Expand Up @@ -399,11 +401,11 @@ public function privateDownloadUrl($path, $domainType = 'default')
return $authUrl;
}

public function persistentFop($path = null, $fops = null)
public function persistentFop($path = null, $fops = null, $pipline = null, $force = false)
{
$auth = $this->getAuth();

$pfop = New PersistentFop($auth, $this->bucket);
$pfop = New PersistentFop($auth, $this->bucket, $pipline, $this->notify_url, $force);

list($id, $error) = $pfop->execute($path, $fops);

Expand Down
5 changes: 3 additions & 2 deletions src/QiniuFilesystemServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ function ($app, $config) {
$config['access_key'],
$config['secret_key'],
$config['bucket'],
$domains
$domains,
$config['notify_url']
);
$file_system = new Filesystem($qiniu_adapter);
$file_system->addPlugin(new PrivateDownloadUrl());
Expand All @@ -53,4 +54,4 @@ public function register()
{
//
}
}
}

0 comments on commit 15b3d75

Please sign in to comment.