pingcrm/app/Http/Controllers/ImagesController.php

24 lines
668 B
PHP

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use League\Glide\ServerFactory;
use Illuminate\Contracts\Filesystem\Filesystem;
use League\Glide\Responses\LaravelResponseFactory;
class ImagesController extends Controller
{
public function show(Filesystem $filesystem, Request $request, $path)
{
$server = ServerFactory::create([
'response' => new LaravelResponseFactory($request),
'source' => $filesystem->getDriver(),
'cache' => $filesystem->getDriver(),
'cache_path_prefix' => '.glide-cache',
]);
return $server->getImageResponse($path, $request->all());
}
}