. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fisharebest\Webtrees\Registry; use Fisharebest\Webtrees\Validator; 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(); $path = Validator::queryParams($request)->string('path'); return Registry::imageFactory()->thumbnailResponse($filesystem, $path, 120, 120, 'contain'); } }