Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.idea
.idea
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"name": "jacobcyl/ali-oss-storage",
"name": "mrbaoquan/ali-oss-storage",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you have changed namespace to yours?

"description": "aliyun oss filesystem storage for laravel 5+",
"keywords": ["aliyun", "oss", "laravel", "filesystems", "storage"],
"homepage": "http://jacobcyl.github.io/Aliyun-oss-storage/",
"homepage": "https://www.parful.com",
"license": "MIT",
"authors": [
{
"name": "jacobcyl",
"email": "cyl.jacob@gmail.com"
"name": "mrbaoquan ",
"email": "mrma617@gmail.com"
}
],
"require": {
"aliyuncs/oss-sdk-php": "~2.0"
},
"autoload": {
"psr-4": {
"Jacobcyl\\AliOSS\\": "src/"
"mrbaoquan\\AliOSS\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Jacobcyl\\AliOSS\\AliOssServiceProvider"
"mrbaoquan\\AliOSS\\AliOssServiceProvider"
]
}
}
Expand Down
8 changes: 4 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ Aliyun oss filesystem storage adapter for laravel 5. You can use Aliyun OSS just
##Installation
In order to install AliOSS-storage, just add

"jacobcyl/ali-oss-storage": "^2.1"
"mrbaoquan/ali-oss-storage": "^2.1"

to your composer.json. Then run `composer install` or `composer update`.
Or you can simply run below command to install:

"composer require jacobcyl/ali-oss-storage:^2.1"
"composer require mrbaoquan/ali-oss-storage:^2.1"

Then in your `config/app.php` add this line to providers array:
```php
Jacobcyl\AliOSS\AliOssServiceProvider::class,
mrbaoquan\AliOSS\AliOssServiceProvider::class,
```
## Configuration
Add the following in app/filesystems.php:
Expand All @@ -34,7 +34,7 @@ Add the following in app/filesystems.php:
'access_key' => '<Your Aliyun OSS AccessKeySecret>',
'bucket' => '<OSS bucket name>',
'endpoint'     => '<the endpoint of OSS, E.g: oss-cn-hangzhou.aliyuncs.com | custom domain, E.g:img.abc.com>', // OSS 外网节点或自定义外部域名
           //'endpoint_internal' => '<internal endpoint [OSS内网节点] 如:oss-cn-shenzhen-internal.aliyuncs.com>', // v2.0.4 新增配置属性,如果为空,则默认使用 endpoint 配置(由于内网上传有点小问题未解决,请大家暂时不要使用内网节点上传,正在与阿里技术沟通中)
           //'endpoint_internal' => '<internal endpoint [OSS内网节点] 如:oss-cn-shenzhen-internal.aliyuncs.com>', // v2.0.4 新增配置属性,如果为空,则默认使用 endpoint 配置
'cdnDomain'     => '<CDN domain, cdn域名>', // 如果isCName为true, getUrl会判断cdnDomain是否设定来决定返回的url,如果cdnDomain未设置,则使用endpoint来生成url,否则使用cdn
'ssl'           => <true|false> // true to use 'https://' and false to use 'http://'. default is false,
'isCName'       => <true|false> // 是否使用自定义域名,true: 则Storage.url()会使用自定义的cdn或域名生成文件url, false: 则使用外部节点生成url
Expand Down
12 changes: 10 additions & 2 deletions src/AliOssAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,16 @@ public function getVisibility($path)
*/
public function getUrl( $path )
{
if (!$this->has($path)) throw new FileNotFoundException($filePath.' not found');
return ( $this->ssl ? 'https://' : 'http://' ) . ( $this->isCname ? ( $this->cdnDomain == '' ? $this->endPoint : $this->cdnDomain ) : $this->bucket . '.' . $this->endPoint ) . '/' . ltrim($path, '/');
/* Should not check if it is exits.while file url is xxx//abc.jpg,it can show in the explore,but return an error by OSS API.
And I don't want to get an exception even though this file is not exists. if an exception occur, my page will not show, that is not my desired result.
*/
if($this->isCname)
{
return $this->cdnDomain.'/'.ltrim($path);
}else
{
return ( $this->ssl ? 'https://' : 'http://' ).( $this->cdnDomain == '' ? $this->endPoint : $this->cdnDomain ). '/' . ltrim($path, '/');
}
}

/**
Expand Down