File tree Expand file tree Collapse file tree 6 files changed +32
-8
lines changed
Expand file tree Collapse file tree 6 files changed +32
-8
lines changed Original file line number Diff line number Diff line change @@ -450,7 +450,7 @@ function loadItems(page) {
450450 } ) ;
451451
452452 if ( item . thumb_url ) {
453- var image = $ ( '<div>' ) . css ( 'background-image' , 'url("' + item . thumb_url + '?timestamp=' + item . time + ' ")') ;
453+ var image = $ ( '<div>' ) . css ( 'background-image' , 'url("' + item . thumb_url + '")' ) ;
454454 } else {
455455 var icon = $ ( '<div>' ) . addClass ( 'ico' ) ;
456456 var image = $ ( '<div>' ) . addClass ( 'mime-icon ico-' + item . icon ) . append ( icon ) ;
@@ -591,7 +591,7 @@ function preview(items) {
591591 . addClass ( index === 0 ? 'active' : '' ) ;
592592
593593 if ( item . thumb_url ) {
594- carouselItem . find ( '.carousel-image' ) . css ( 'background-image' , 'url(\'' + item . url + '?timestamp=' + item . time + ' \')') ;
594+ carouselItem . find ( '.carousel-image' ) . css ( 'background-image' , 'url(\'' + item . url + '\')' ) ;
595595 } else {
596596 carouselItem . find ( '.carousel-image' ) . css ( 'width' , '50vh' ) . append ( $ ( '<div>' ) . addClass ( 'mime-icon ico-' + item . icon ) ) ;
597597 }
Original file line number Diff line number Diff line change @@ -8,12 +8,25 @@ 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 response ()->download ($ file ->path ('absolute ' ));
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 (
24+ function () {
25+ echo file_get_contents ($ disk ->temporaryUrl ($ file ->path ('storage ' ), now ()->addMinutes ($ duration )));
26+ }, $ file_name ,
27+ );
28+ } else {
29+ return response ()->download ($ file ->path ('absolute ' ));
30+ }
1831 }
1932}
Original file line number Diff line number Diff line change @@ -43,7 +43,16 @@ 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+
50+ $ duration = $ this ->helper ->config ('s3.temporary_url_expiration ' );
51+ return $ this ->disk ->temporaryUrl ($ path , now ()->addMinutes ($ duration ));
52+
53+ else {
54+ return $ this ->disk ->url ($ path );
55+ }
4756 }
4857
4958 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