<?php

  include("admin/opendb.php");

  $sql = "SELECT * FROM gallery";
  $result = mysqli_query($conn,$sql);
  $images = mysqli_fetch_all($result, MYSQLI_ASSOC);

  $pageTitle = "Gallery - PSN MENTOR";
  $activeMenu = "gallery";
  include("parts/header.php");
?>

  <main class="main">

    <!-- ======= Gallery Section ======= -->
    <section id="gallery" class="gallery section">
      <div class="container" data-aos="fade-up">
        <div class="section-title text-center">
          <h2>Gallery</h2>
          <p>Memorable Moments</p>
        </div>

        <div class="row g-4">

          <!-- Gallery Item -->
          <?php foreach($images as $image){ ?>
          <div class="col-lg-4 col-md-6">
            <a href="admin/uploads/<?= $image['image'] ?>" class="glightbox">
              <img src="admin/uploads/<?= $image['image'] ?>" class="img-fluid rounded shadow-sm" alt="Gallery Image 1">
            </a>
          </div>
          <?php } ?>
        </div>
      </div>
    </section>
    <!-- End Gallery Section -->

  </main>

  <?php
  include("parts/footer.php");
  ?>
