Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
5c60947c
Unverified
Commit
5c60947c
authored
Sep 30, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preparing a future frontcontroller for accessing media
parent
8c37d199
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
1 deletion
+46
-1
MediaController.php
Modules/Media/Http/Controllers/Frontend/MediaController.php
+35
-0
frontendRoutes.php
Modules/Media/Http/frontendRoutes.php
+10
-0
RouteServiceProvider.php
Modules/Media/Providers/RouteServiceProvider.php
+1
-1
No files found.
Modules/Media/Http/Controllers/Frontend/MediaController.php
0 → 100644
View file @
5c60947c
<?php
namespace
Modules\Media\Http\Controllers\Frontend
;
use
Illuminate\Routing\Controller
;
use
Illuminate\Support\Facades\Storage
;
use
Intervention\Image\Facades\Image
;
use
Modules\Media\Repositories\FileRepository
;
class
MediaController
extends
Controller
{
/**
* @var FileRepository
*/
private
$file
;
public
function
__construct
(
FileRepository
$file
)
{
$this
->
file
=
$file
;
}
public
function
show
(
$path
)
{
$file
=
$this
->
file
->
findForVirtualPath
(
$path
);
$type
=
$file
->
mimetype
;
$path
=
storage_path
(
'app'
.
$file
->
path
->
getRelativeUrl
());
return
Image
::
make
(
$path
)
->
response
();
return
response
()
->
file
(
$path
,
[
"Content-Type:
$type
"
]);
}
}
Modules/Media/Http/frontendRoutes.php
0 → 100644
View file @
5c60947c
<?php
use
Illuminate\Routing\Router
;
/** @var Router $router */
//$router->get('assets/newmedia/{path}', [
// 'as' => 'public.media.media.show',
// 'uses' => 'Frontend\MediaController@show',
//]);
Modules/Media/Providers/RouteServiceProvider.php
View file @
5c60947c
...
...
@@ -17,7 +17,7 @@ class RouteServiceProvider extends CoreRoutingServiceProvider
*/
protected
function
getFrontendRoute
()
{
return
false
;
return
__DIR__
.
'/../Http/frontendRoutes.php'
;
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment