X7ROOT File Manager
Current Path:
/home/u126090504/domains/sketkaranjia.com/public_html/admin
home
/
u126090504
/
domains
/
sketkaranjia.com
/
public_html
/
admin
/
📁
..
📄
achievers.php
(21.44 KB)
📄
achv_cat_manage.php
(7.99 KB)
📄
achv_edit.php
(9.58 KB)
📄
achv_list.php
(8.08 KB)
📄
achv_upload.php
(13.39 KB)
📄
admin-academic-calendar.php
(20.41 KB)
📄
admin-public-disclosure.php
(18.36 KB)
📄
admissions.php
(28.76 KB)
📄
admissions_error.log
(56 KB)
📁
assets
📄
banners.php
(9.78 KB)
📄
branding_settings.php
(5.93 KB)
📄
change_password.php
(3.01 KB)
📄
class_master.php
(4.32 KB)
📄
contacts.php
(3.83 KB)
📄
dashboard.php
(27.76 KB)
📄
downloads.php
(4.91 KB)
📄
edit_faculty.php
(6.85 KB)
📄
events.php
(920 B)
📄
export_franchise.php
(930 B)
📄
faculty.php
(8.36 KB)
📄
fees_list.php
(8.48 KB)
📄
fees_upload.php
(6.19 KB)
📄
forgot_password.php
(5.76 KB)
📄
franchise.php
(7.28 KB)
📄
gallery.php
(3.08 KB)
📄
grievance-update.php
(1003 B)
📄
grievance-view.php
(8.51 KB)
📄
grievances.php
(9.55 KB)
📄
homework_add.php
(5.98 KB)
📄
homework_edit.php
(9.39 KB)
📄
homework_list.php
(2.24 KB)
📁
img
📁
includes
📄
index.php
(82 B)
📄
login.php
(13.47 KB)
📄
logout.php
(102 B)
📄
manage_albums.php
(10.82 KB)
📄
manage_media.php
(11.77 KB)
📄
manage_photos.php
(6.35 KB)
📄
manage_videos.php
(18.38 KB)
📄
managing-committee.php
(13.64 KB)
📄
master_menu.php
(5.75 KB)
📄
master_menu_debug.php
(3.73 KB)
📄
new_password.php
(3.9 KB)
📄
non_academic_achievers.php
(21.2 KB)
📄
notice.php
(15.52 KB)
📄
notice_error.log
(38.45 KB)
📄
notices.php
(8.24 KB)
📄
payments.php
(14.96 KB)
📁
phpmailer
📄
popup.php
(14.07 KB)
📄
reset_password.php
(2.27 KB)
📄
section_master.php
(6.59 KB)
📄
sections_by_class.php
(346 B)
📄
secure_session.php
(1000 B)
📄
settings.php
(8.34 KB)
📄
student_photo_update.php
(1.8 KB)
📄
subject_master.php
(6.16 KB)
📄
submit-grievance.php
(4.97 KB)
📄
testimonials.php
(15.15 KB)
📄
update_status.php
(1.66 KB)
📄
upi_settings.php
(1.52 KB)
Editing: manage_photos.php
<?php include 'secure_session.php'; include 'includes/auth.php'; require_once '../config.php'; include 'includes/header.php'; // ✅ Resize to fit inside 1080×1080 (no cropping) function resizeTo1080($source, $destination, $quality = 85) { $info = getimagesize($source); $mime = $info['mime']; switch ($mime) { case 'image/jpeg': $image = imagecreatefromjpeg($source); break; case 'image/png': $image = imagecreatefrompng($source); break; case 'image/gif': $image = imagecreatefromgif($source); break; default: return false; } $width = imagesx($image); $height = imagesy($image); $maxSize = 1080; // Maintain aspect ratio if ($width > $height) { $newWidth = $maxSize; $newHeight = intval($height * ($maxSize / $width)); } else { $newHeight = $maxSize; $newWidth = intval($width * ($maxSize / $height)); } $resized = imagecreatetruecolor($newWidth, $newHeight); imagecopyresampled($resized, $image, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height); // Add white background $final = imagecreatetruecolor($maxSize, $maxSize); $white = imagecolorallocate($final, 255, 255, 255); imagefill($final, 0, 0, $white); // Center image $x = ($maxSize - $newWidth) / 2; $y = ($maxSize - $newHeight) / 2; imagecopy($final, $resized, $x, $y, 0, 0, $newWidth, $newHeight); // Save final output if ($mime == 'image/png') imagepng($final, $destination, 6); elseif ($mime == 'image/gif') imagegif($final, $destination); else imagejpeg($final, $destination, $quality); imagedestroy($image); imagedestroy($resized); imagedestroy($final); return true; } // ✅ Upload Photos if (isset($_POST['upload'])) { $album_id = intval($_POST['album_id']); if (!isset($_FILES['photos'])) return; foreach ($_FILES['photos']['name'] as $i => $name) { if ($_FILES['photos']['error'][$i] !== 0) continue; $size = $_FILES['photos']['size'][$i]; if ($size > 1572864) { echo "<div class='alert alert-danger'>❌ {$name} skipped (over 1.5MB)</div>"; continue; } $tmp = $_FILES['photos']['tmp_name'][$i]; $fileName = time() . '_' . basename($name); $target = "../uploads/gallery/" . $fileName; $quality = 85; if (resizeTo1080($tmp, $target, $quality)) { while (filesize($target) > 600 * 1024 && $quality > 40) { $quality -= 5; resizeTo1080($tmp, $target, $quality); } $conn->query("INSERT INTO photos (album_id, filename) VALUES ('$album_id', '$fileName')"); echo "<div class='alert alert-success'>✅ {$name} uploaded successfully.</div>"; } else { echo "<div class='alert alert-warning'>❌ {$name} failed to upload.</div>"; } } } // ✅ Delete Photos if (isset($_GET['delete'])) { $id = intval($_GET['delete']); $photo = $conn->query("SELECT filename FROM photos WHERE id=$id")->fetch_assoc(); if ($photo) { $path = "../uploads/gallery/" . $photo['filename']; if (file_exists($path)) unlink($path); $conn->query("DELETE FROM photos WHERE id=$id"); } } ?> <!-- ✅ Main Page Wrapper --> <main class="main-content" style="background:#f9fafb; min-height:100vh; padding:30px;"> <!-- ✅ Header Row --> <div class="d-flex justify-content-between align-items-center mb-4"> <h2 class="fw-bold text-danger" style="font-family:'Poppins',sans-serif;"> 📸 Manage Gallery </h2> <div> <a href="manage_albums.php" class="btn btn-danger me-2">➕ New Album</a> <a href="dashboard.php" class="btn btn-dark">⬅ Dashboard</a> </div> </div> <!-- ✅ Upload Form (Full Width) --> <div class="card border-0 shadow-sm p-4 mb-5" style="border-radius:12px; width:100%;"> <form method="post" enctype="multipart/form-data"> <div class="row"> <div class="col-md-6 mb-3"> <label class="form-label fw-semibold">Select Album</label> <select name="album_id" class="form-control" required> <option value="">-- Choose Album --</option> <?php $albums = $conn->query("SELECT * FROM albums ORDER BY name ASC"); while ($a = $albums->fetch_assoc()) { echo "<option value='{$a['id']}'>{$a['name']}</option>"; } ?> </select> </div> <div class="col-md-6 mb-3"> <label class="form-label fw-semibold">Choose Photos (Multiple)</label> <input type="file" name="photos[]" class="form-control" multiple required> <small class="text-muted">Each image auto-fits inside 1080×1080px & compresses ≤600KB.</small> </div> </div> <div class="text-end"> <button type="submit" name="upload" class="btn btn-success px-4">Upload Photos</button> </div> </form> </div> <!-- ✅ All Uploaded Photos --> <h4 class="fw-bold mb-3" style="font-family:'Poppins',sans-serif;">🖼 All Uploaded Photos</h4> <div class="row"> <?php $res = $conn->query("SELECT p.*, a.name AS album FROM photos p JOIN albums a ON p.album_id=a.id ORDER BY p.uploaded_at DESC"); if ($res->num_rows == 0) { echo "<p class='text-muted text-center'>No photos uploaded yet.</p>"; } while ($r = $res->fetch_assoc()) { echo "<div class='col-xl-2 col-lg-3 col-md-4 col-sm-6 mb-4'> <div class='card p-2 text-center shadow-sm border-0 h-100'> <img src='../uploads/gallery/{$r['filename']}' class='img-fluid img-preview mb-2' alt='photo'> <p class='fw-bold text-danger small mb-1'>{$r['album']}</p> <a href='?delete={$r['id']}' class='btn btn-sm btn-outline-danger' onclick='return confirm(\"Delete this photo?\")'>Delete</a> </div> </div>"; } ?> </div> </main> <!-- ✅ Styles --> <style> body { font-family: 'Poppins', sans-serif; background-color: #f9fafb; } .img-preview { height: 200px; width: 100%; object-fit: contain; background: #fff; border-radius: 10px; padding: 6px; } </style> <?php include 'includes/footer.php'; ?>
Upload File
Create Folder