Initial commit

This commit is contained in:
2024-08-27 19:03:24 -05:00
commit 5438f9e358
27 changed files with 2693 additions and 0 deletions

28
web/scripts/init_db.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
// .php
require_once 'vendor/autoload.php';
use Hpz\Photogal\Database;
use Hpz\Photogal\Image;
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/..');
$dotenv->load();
if (!isset($_ENV['DB_FILE_PATH'])) {
die('DB_FILE_PATH is not set in the .env file');
}
// Specify the path to the SQLite database file
$dbFilePath = $_ENV['DB_FILE_PATH'];
// Create a new Database connection
$database = new Database($dbFilePath);
// Create the Image table
$image = new Image($database);
if ($image->createTable()) {
echo "Database and table initialized successfully.";
} else {
echo "Failed to initialize database and table.";
}