. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fisharebest\Webtrees\Registry; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; /** * Create a thumbnail of a file, for use on the admin page. */ class AdminMediaFileThumbnail implements RequestHandlerInterface { /** * Show an image/thumbnail, with/without a watermark. * * @param ServerRequestInterface $request * * @return ResponseInterface */ public function handle(ServerRequestInterface $request): ResponseInterface { $filesystem = Registry::filesystem()->data(); $params = (array) $request->getQueryParams(); $path = $params['path'] ?? ''; return Registry::imageFactory()->thumbnailResponse($filesystem, $path, 120, 120, 'contain'); } }