File tree Expand file tree Collapse file tree 2 files changed +27
-7
lines changed Expand file tree Collapse file tree 2 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,12 @@ MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
44
44
45
45
FILESYSTEM_DRIVER = public
46
46
47
+ AWS_ACCESS_KEY_ID = null
48
+ AWS_SECRET_ACCESS_KEY = null
49
+ AWS_DEFAULT_REGION = ap-northeast-1
50
+ AWS_BUCKET = laravel-react-admin
51
+ AWS_URL = https://laravel-react-admin.s3.ap-northeast-1.amazonaws.com
52
+
47
53
TELESCOPE_ENABLED = true
48
54
49
55
JWT_SECRET = noclue
Original file line number Diff line number Diff line change @@ -38,14 +38,28 @@ public static function upload(string $directory, $file)
38
38
Storage::makeDirectory ($ thumbnailDirectory );
39
39
}
40
40
41
- $ fileSystemRoot = config ("filesystems.disks. {$ disk }.root " );
42
- $ fullPath = "{$ fileSystemRoot }/ {$ path }" ;
43
- $ fullThumbnailPath =
44
- "{$ fileSystemRoot }/ {$ thumbnailDirectory }/ {$ filename }" ;
41
+ switch ($ disk ) {
42
+ case 's3 ' :
43
+ $ fullThumbnailPath = "{$ thumbnailDirectory }/ {$ filename }" ;
45
44
46
- $ image = Image::make ($ fullPath )
47
- ->fit (240 )
48
- ->save ($ fullThumbnailPath , 95 );
45
+ $ image = Image::make ($ url )
46
+ ->fit (240 )
47
+ ->stream ();
48
+
49
+ Storage::put ($ fullThumbnailPath , $ image ->__toString ());
50
+ break ;
51
+
52
+ default :
53
+ $ fileSystemRoot = config ("filesystems.disks. {$ disk }.root " );
54
+ $ fullPath = "{$ fileSystemRoot }/ {$ path }" ;
55
+ $ fullThumbnailPath =
56
+ "{$ fileSystemRoot }/ {$ thumbnailDirectory }/ {$ filename }" ;
57
+
58
+ Image::make ($ fullPath )
59
+ ->fit (240 )
60
+ ->save ($ fullThumbnailPath , 95 );
61
+ break ;
62
+ }
49
63
50
64
$ thumbnail_filesize = Storage::size ($ thumbnailPath );
51
65
$ thumbnail_url = Storage::url ($ thumbnailPath );
You can’t perform that action at this time.
0 commit comments