2019-08-09 12:33:47 -03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2021-05-10 17:18:33 -03:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use League\Glide\ServerFactory;
|
|
|
|
use Illuminate\Contracts\Filesystem\Filesystem;
|
|
|
|
use League\Glide\Responses\LaravelResponseFactory;
|
2019-08-09 12:33:47 -03:00
|
|
|
|
|
|
|
class ImagesController extends Controller
|
|
|
|
{
|
2021-05-10 17:18:33 -03:00
|
|
|
public function show(Filesystem $filesystem, Request $request, $path)
|
2019-08-09 12:33:47 -03:00
|
|
|
{
|
2021-05-10 17:18:33 -03:00
|
|
|
$server = ServerFactory::create([
|
|
|
|
'response' => new LaravelResponseFactory($request),
|
|
|
|
'source' => $filesystem->getDriver(),
|
|
|
|
'cache' => $filesystem->getDriver(),
|
|
|
|
'cache_path_prefix' => '.glide-cache',
|
|
|
|
]);
|
|
|
|
|
|
|
|
return $server->getImageResponse($path, $request->all());
|
2019-08-09 12:33:47 -03:00
|
|
|
}
|
|
|
|
}
|