TravelThing/public/detail.php
2025-04-11 20:01:50 -05:00

64 lines
1.5 KiB
PHP

<?php
require_once "../lib.php";
$db = new SQLite3(DB_PATH);
$stmt = $db->prepare($imageSelectSql . " WHERE ImageID=? LIMIT 1");
$stmt->bindValue(1, $_GET["id"] ?? 2, SQLITE3_NUM);
$img = $stmt->execute()->fetchArray();
$imageURL = "/assets/img/640/" . $img['Path'];
$exif = json_decode(stripslashes($img['Exif']));
$colors = json_decode(stripslashes($img['Colors']));
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Chapter 14</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/assets/css/styles.css">
</head>
<body>
<main class="detail">
<div>
<img src="<?php echo $imageURL; ?>" alt="<?php echo $img['Title']; ?>">
</div>
<div>
<h1><?= $img['Title'] ?></h1>
<h3><?= $img['AsciiName'] . ', ' . $img['CountryName'] ?></h3>
<p><?php echo $img['Description'] ?></p>
<div class="box">
<h3>Creator</h3>
<p><a href="<?= $img['CreatorURL'] ?>"><?= $img['ActualCreator'] ?></a></p>
<p><a href="<?= $img['SourceURL'] ?>"><?= $img['SourceURL'] ?></a></p>
</div>
<div class="box">
<h3>Camera</h3>
<?php if (isset($exif)) { ?>
<p><?= $exif->model ?></p>
<p>ISO <?=$exif->iso ?> | f<?=$exif->aperture ?> | <?=$exif->exposure_time ?> sec</p>
<?php } else { ?>
<p>No exif information available</p>
<?php } ?>
</div>
<div class="box">
<h3>Colors</h3>
<div class="colorBoxes">
<?php foreach ($colors as $c) { ?>
<span style='background-color: <?= $c ?>'></span>
<?php } ?>
</div>
</div>
</div>
</main>
</body>
</html>