pingcrm/app/Http/Controllers/ImagesController.php

24 lines
668 B
PHP
Raw Normal View History

2019-08-09 12:33:47 -03:00
<?php
namespace App\Http\Controllers;
2021-05-10 17:18:33 -03:00
use Illuminate\Contracts\Filesystem\Filesystem;
2021-12-08 13:59:08 -03:00
use Illuminate\Http\Request;
2021-05-10 17:18:33 -03:00
use League\Glide\Responses\LaravelResponseFactory;
2021-12-08 13:59:08 -03:00
use League\Glide\ServerFactory;
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
}
}