D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
proc
/
thread-self
/
root
/
home
/
markniuj
/
bazmeasar.com
/
Filename :
all_ashaar.php
back
Copy
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Image Gallery</title> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/css/bootstrap.min.css"> <style> .thumbnail { width: 100px; height: 100px; object-fit: cover; } .img-fluid { max-width: 40%; height: auto; } </style> </head> <body> <div class="container mt-4"> <h1 class="text-center mb-4">Image Gallery</h1> <table class="table"> <thead> <tr> <th>Thumbnail</th> <th>Date of Picture</th> <th>Category</th> </tr> </thead> <tbody> <?php include 'config.php'; // Number of items per page $itemsPerPage = 1; // Calculate the total number of pages $sqlCount = "SELECT COUNT(*) AS total FROM pictures"; $countResult = $conn->query($sqlCount); $rowCount = $countResult->fetch_assoc()['total']; $totalPages = ceil($rowCount / $itemsPerPage); // Check if the "page" parameter is set in the URL $currentPage = isset($_GET['page']) ? $_GET['page'] : 1; // Calculate the starting index of the items for the current page $startIndex = ($currentPage - 1) * $itemsPerPage; // Query to retrieve images from the "pictures" table with pagination and including the 'id' column $sql = "SELECT id, picture_path, date_of_picture, category FROM pictures ORDER BY date_of_picture DESC LIMIT $startIndex, $itemsPerPage"; $result = $conn->query($sql); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { echo '<tr>'; $folderName = 'admin'; // Set your folder name here $imagePath = $folderName . '/' . $row['picture_path']; // Concatenate folder name and path echo '<img src="' . $imagePath . '" class="img-fluid" alt="Image">'; echo '<div class="date-info">'; echo '<td><img src="' . $row['picture_path'] . '" class="thumbnail" alt="Image"></td>'; echo '<td>' . $row['date_of_picture'] . '</td>'; echo '<td>' . $row['category'] . '</td>'; echo '<td><a href="delete_image.php?id=' . $row['id'] . '" class="delete-btn">delete<i class="bi bi-trash"></i></a></td>'; echo '</tr>'; } } else { echo '<tr><td colspan="3">No images found.</td></tr>'; } $conn->close(); ?> </tbody> </table> <nav aria-label="Page navigation example"> <ul class="pagination justify-content-center"> <?php for ($i = 1; $i <= $totalPages; $i++) { $active = $i == $currentPage ? 'active' : ''; echo '<li class="page-item ' . $active . '"><a class="page-link" href="?page=' . $i . '">' . $i . '</a></li>'; } ?> </ul> </nav> </div> <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/js/bootstrap.bundle.min.js"></script> </body> </html>