File tree Expand file tree Collapse file tree 6 files changed +28
-8
lines changed Expand file tree Collapse file tree 6 files changed +28
-8
lines changed Original file line number Diff line number Diff line change @@ -455,7 +455,7 @@ function loadItems(page) {
455455 } ) ;
456456
457457 if ( item . thumb_url ) {
458- var image = $ ( '<div>' ) . css ( 'background-image' , 'url("' + item . thumb_url + '?timestamp=' + item . time + ' ")') ;
458+ var image = $ ( '<div>' ) . css ( 'background-image' , 'url("' + item . thumb_url + '")' ) ;
459459 } else {
460460 var icon = $ ( '<div>' ) . addClass ( 'ico' ) ;
461461 var image = $ ( '<div>' ) . addClass ( 'mime-icon ico-' + item . icon ) . append ( icon ) ;
@@ -601,7 +601,7 @@ function preview(items) {
601601 . addClass ( index === 0 ? 'active' : '' ) ;
602602
603603 if ( item . thumb_url ) {
604- carouselItem . find ( '.carousel-image' ) . css ( 'background-image' , 'url(\'' + item . url + '?timestamp=' + item . time + ' \')') ;
604+ carouselItem . find ( '.carousel-image' ) . css ( 'background-image' , 'url(\'' + item . url + '\')' ) ;
605605 } else {
606606 carouselItem . find ( '.carousel-image' ) . css ( 'width' , '50vh' ) . append ( $ ( '<div>' ) . addClass ( 'mime-icon ico-' + item . icon ) ) ;
607607 }
Original file line number Diff line number Diff line change @@ -8,12 +8,23 @@ class DownloadController extends LfmController
88{
99 public function getDownload ()
1010 {
11- $ file = $ this ->lfm ->setName (request ('file ' ));
11+ $ file_name = request ('file ' );
12+ $ file = $ this ->lfm ->setName ($ file_name );
1213
1314 if (!Storage::disk ($ this ->helper ->config ('disk ' ))->exists ($ file ->path ('storage ' ))) {
1415 abort (404 );
1516 }
1617
17- return Storage::disk ($ this ->helper ->config ('disk ' ))->download ($ file ->path ('storage ' ));
18+ $ disk = Storage::disk ($ this ->helper ->config ('disk ' ));
19+ $ config = $ disk ->getConfig ();
20+
21+ if (key_exists ('driver ' , $ config ) && $ config ['driver ' ] == 's3 ' ) {
22+ $ duration = $ this ->helper ->config ('temporary_url_duration ' );
23+ return response ()->streamDownload (function () {
24+ echo file_get_contents ($ disk ->temporaryUrl ($ file ->path ('storage ' ), now ()->addMinutes ($ duration )));
25+ }, $ file_name );
26+ } else {
27+ return response ()->download ($ file ->path ('absolute ' ));
28+ }
1829 }
1930}
Original file line number Diff line number Diff line change @@ -43,7 +43,14 @@ public function save($file)
4343
4444 public function url ($ path )
4545 {
46- return $ this ->disk ->url ($ path );
46+ $ config = $ this ->disk ->getConfig ();
47+
48+ if (key_exists ('driver ' , $ config ) && $ config ['driver ' ] == 's3 ' ) {
49+ $ duration = $ this ->helper ->config ('temporary_url_duration ' );
50+ return $ this ->disk ->temporaryUrl ($ path , now ()->addMinutes ($ duration ));
51+ } else {
52+ return $ this ->disk ->url ($ path );
53+ }
4754 }
4855
4956 public function makeDirectory ()
Original file line number Diff line number Diff line change 9696
9797 'disk ' => 'public ' ,
9898
99+ 'temporary_url_duration ' => 30 ,
100+
99101 'rename_file ' => false ,
100102
101103 'rename_duplicates ' => false ,
Original file line number Diff line number Diff line change 11<div class =" row no-gutters" >
22 <div class =" col-xl-8" >
33 <div class =" crop-container" >
4- <img src =" {{ $img -> url . ' ?timestamp= ' . $img -> time } }" class =" img img-responsive" >
4+ <img src =" {{ $img -> url } }" class =" img img-responsive" >
55 </div >
66 </div >
77 <div class =" col-xl-4" >
Original file line number Diff line number Diff line change 1919 <div class =" row" >
2020 <div class =" col-md-8 bg-light" id =" work_space" >
2121 <div id =" containment" class =" d-none d-md-inline" >
22- <img id =" resize" src =" {{ $img -> url . ' ?timestamp= ' . $img -> time } }" height =" {{ $height } }" width =" {{ $width } }" >
22+ <img id =" resize" src =" {{ $img -> url } }" height =" {{ $height } }" width =" {{ $width } }" >
2323 </div >
24- <div id =" resize_mobile" style =" background-image : url ({{ $img->url . ' ?timestamp= ' . $img->time }} )" class =" d-block d-md-none" ></div >
24+ <div id =" resize_mobile" style =" background-image : url ({{ $img->url }} )" class =" d-block d-md-none" ></div >
2525 </div >
2626 <div class =" col-md-4 pt-3" >
2727 <table class =" table table-compact table-striped" >
You can’t perform that action at this time.
0 commit comments