File tree Expand file tree Collapse file tree 3 files changed +10
-11
lines changed Expand file tree Collapse file tree 3 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 18
18
'api_host ' => env ('OZU_API_HOST ' , 'https://ozu.code16.fr/ ' ),
19
19
'api_version ' => env ('OZU_API_VERSION ' , 'v1 ' ),
20
20
21
- 'cdn ' => [
22
- 'provider ' => env ('OZU_CDN_PROVIDER ' ),
23
- 'url ' => env ('OZU_CDN_URL ' ),
24
- ],
21
+ 'cdn_url ' => env ('OZU_CDN_URL ' ),
25
22
];
Original file line number Diff line number Diff line change @@ -48,15 +48,17 @@ public function register()
48
48
$ this ->app ->bind (Paginator::class, StaticPaginator::class);
49
49
$ this ->app ->bind (LengthAwarePaginator::class, StaticLengthAwarePaginator::class);
50
50
$ this ->app ->bind (Thumbnail::class, function ($ app ) {
51
- if (!$ app ->environment ('production ' ) || !config ('ozu-client.cdn.url ' )) {
51
+ if (!$ app ->environment ('production ' ) || !config ('ozu-client.cdn_url ' )) {
52
52
return $ app ->make (LocalThumbnail::class);
53
53
}
54
54
55
- return match (config ('ozu-client.cdn.provider ' )) {
56
- 'imagekit ' => $ app ->make (ImageKitThumbnail::class),
57
- 'keycdn ' => $ app ->make (KeyCdnThumbnail::class),
58
- default => $ app ->make (LocalThumbnail::class)
59
- };
55
+ // Have to rely on the URL to determine the CDN provider for now,
56
+ // because we are limited to 10 params for the deployment script :/
57
+ if (str (config ('ozu-client.cdn_url ' ))->contains ('kxcdn.com ' )) {
58
+ return $ app ->make (KeyCdnThumbnail::class);
59
+ }
60
+
61
+ return $ app ->make (ImageKitThumbnail::class);
60
62
});
61
63
62
64
$ this ->app ->register (DeployServiceProvider::class);
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ abstract class CdnThumbnail extends Thumbnail
6
6
{
7
7
public function make (?int $ width , ?int $ height = null , bool $ fit = false ): ?string
8
8
{
9
- if ($ cdnUrl = str (config ('ozu-client.cdn.url ' ))->rtrim ('/ ' )) {
9
+ if ($ cdnUrl = str (config ('ozu-client.cdn_url ' ))->rtrim ('/ ' )) {
10
10
return sprintf (
11
11
'%s/storage/%s?%s ' ,
12
12
$ cdnUrl ,
You can’t perform that action at this time.
0 commit comments