| Server IP : 127.0.0.1 / Your IP : 192.168.99.1 Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9 System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64 User : Administrator ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /laragon4/www/bpkd_/ |
Upload File : |
<?php
/**
* Halaman Detail Galeri
*/
require_once 'includes/init.php';
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
if ($id <= 0) {
header('Location: galeri.php');
exit;
}
$item = getGalleryById($conn, $id);
if (!$item) {
header('Location: galeri.php');
exit;
}
// Update views
updateGalleryViews($conn, $id);
// Get related items
$related_items = getGalleryByCategory($conn, $item['category'], 4);
$page_title = $item['title'] . ' - Galeri ' . ($settings['site_title'] ?? 'Website Instansi');
$meta_description = $item['description'] ?? 'Detail foto/video galeri';
include 'includes/header.php';
?>
<section class="detail-gallery py-5">
<div class="container">
<div class="row">
<div class="col-lg-8 mx-auto">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
<li class="breadcrumb-item"><a href="galeri.php">Galeri</a></li>
<li class="breadcrumb-item active">Detail</li>
</ol>
</nav>
<div class="card shadow">
<div class="card-body">
<?php if ($item['type'] == 'video'): ?>
<div class="ratio ratio-16x9 mb-4">
<iframe src="<?php echo $item['video_url']; ?>" title="<?php echo htmlspecialchars($item['title']); ?>" allowfullscreen></iframe>
</div>
<?php else: ?>
<img src="<?php echo getImageOrDefault($item['image'], 'gallery', $item['title'], 800, 600); ?>" alt="<?php echo htmlspecialchars($item['title']); ?>" class="img-fluid rounded mb-4">
<?php endif; ?>
<h2><?php echo htmlspecialchars($item['title']); ?></h2>
<div class="meta-info text-muted mb-3">
<span class="me-3"><i class="far fa-calendar me-1"></i> <?php echo tgl_indonesia($item['created_at']); ?></span>
<span class="me-3"><i class="far fa-folder me-1"></i> <?php echo $item['category']; ?></span>
<span><i class="far fa-eye me-1"></i> <?php echo number_format($item['views']); ?> views</span>
</div>
<?php if (!empty($item['description'])): ?>
<div class="description">
<h5>Deskripsi:</h5>
<p><?php echo nl2br(htmlspecialchars($item['description'])); ?></p>
</div>
<?php endif; ?>
<!-- Share Buttons -->
<div class="share-buttons mt-4">
<h5>Bagikan:</h5>
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo urlencode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); ?>" target="_blank" class="btn btn-facebook me-2">
<i class="fab fa-facebook-f"></i>
</a>
<a href="https://twitter.com/intent/tweet?url=<?php echo urlencode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); ?>&text=<?php echo urlencode($item['title']); ?>" target="_blank" class="btn btn-twitter me-2">
<i class="fab fa-twitter"></i>
</a>
<a href="https://wa.me/?text=<?php echo urlencode($item['title'] . ' - ' . 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); ?>" target="_blank" class="btn btn-whatsapp">
<i class="fab fa-whatsapp"></i>
</a>
</div>
</div>
</div>
<!-- Related Items -->
<?php if (!empty($related_items)): ?>
<div class="related-gallery mt-5">
<h3 class="mb-4">Galeri Terkait</h3>
<div class="row g-3">
<?php foreach ($related_items as $rel): ?>
<?php if ($rel['id'] != $item['id']): ?>
<div class="col-md-3 col-6">
<a href="detail-galeri.php?id=<?php echo $rel['id']; ?>" class="text-decoration-none">
<img src="<?php echo getImageOrDefault($rel['image'], 'gallery', $rel['title'], 200, 150); ?>" alt="<?php echo htmlspecialchars($rel['title']); ?>" class="img-fluid rounded">
<p class="small text-muted mt-2"><?php echo substr($rel['title'], 0, 30); ?>...</p>
</a>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
</div>
</div>
</div>
</section>
<?php include 'includes/footer.php'; ?>