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}"
4444
4545FILESYSTEM_DRIVER = public
4646
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+
4753TELESCOPE_ENABLED = true
4854
4955JWT_SECRET = noclue
Original file line number Diff line number Diff line change @@ -38,14 +38,28 @@ public static function upload(string $directory, $file)
3838 Storage::makeDirectory ($ thumbnailDirectory );
3939 }
4040
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 }" ;
4544
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+ }
4963
5064 $ thumbnail_filesize = Storage::size ($ thumbnailPath );
5165 $ thumbnail_url = Storage::url ($ thumbnailPath );
You can’t perform that action at this time.
0 commit comments