add 'inline' route to allow embedding uploads

This change adds an 'inline' route to uploads which sets the
'Content-Disposition' HTTP header to 'inline'. This allows modules to
embed and display uploads in an HTML 'embed' element.
This commit is contained in:
Hendrik Hagendorn
2023-05-21 14:16:48 +02:00
parent 9429728281
commit d3661038ac
3 changed files with 19 additions and 1 deletions

View File

@ -118,7 +118,7 @@ trait Uploads
return $path;
}
public function streamMedia($media)
public function streamMedia($media, $disposition = 'attachment')
{
return response()->streamDownload(
function() use ($media) {
@ -133,6 +133,7 @@ trait Uploads
'Content-Type' => $media->mime_type,
'Content-Length' => $media->size,
],
$disposition,
);
}