Debuggy time

This commit is contained in:
Lewis Dale 2023-08-27 21:36:01 +01:00
parent 16e0a8f381
commit 9164929969
2 changed files with 7 additions and 2 deletions

View File

@ -12,7 +12,7 @@ $logger = new FileLogger("resizer.log");
$dotenv = Dotenv\Dotenv::createImmutable([__DIR__, __DIR__ . "/.."]);
$dotenv->load();
$imageDb = new SqliteImageDb(new PDO("sqlite:{$_ENV["db_name"]}"));
$imageDb = new SqliteImageDb(new PDO("sqlite:{$_ENV["db_name"]}"), $logger);
$imgPath = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$params = new ResizeParams($_GET);

View File

@ -5,10 +5,12 @@ namespace ImageResizer\Lib;
use ImageResizer\Models\Image;
use ImageResizer\Models\ResizeParams;
use Psr\Log\AbstractLogger;
class SqliteImageDb implements ImageDb {
public function __construct(
private readonly \PDO $db
private readonly \PDO $db,
private readonly AbstractLogger $logger,
) {
$this->up();
}
@ -22,6 +24,9 @@ class SqliteImageDb implements ImageDb {
quality INTEGER NULLABLE,
content TEXT NOT NULL
)');
$crs = $this->db->query('SELECT * FROM images');
$this->logger->info('Found something', ['results '=> $crs->fetchAll()]);
}
public function findImage(string $path, ResizeParams $params): Image | null {