mirror of
https://github.com/Fluffy-Bean/image-gallery.git
synced 2025-06-29 21:06:16 +00:00
Fixing broken looking UI when no images present
This commit is contained in:
parent
8cb2fea9cd
commit
afdaab4e13
4 changed files with 68 additions and 48 deletions
|
@ -182,6 +182,10 @@
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (empty($group['image_list']) && $_GET['mode'] != "edit" && !empty($_GET['id'])) {
|
if (empty($group['image_list']) && $_GET['mode'] != "edit" && !empty($_GET['id'])) {
|
||||||
|
echo "<div class='info-text defaultFonts'>
|
||||||
|
<h1>Nothing here!</h1>
|
||||||
|
<p>There are no images in the group, add some!</p>
|
||||||
|
</div>";
|
||||||
echo "<div id='gallery' class='gallery-root defaultDecoration' style='display: none;'>";
|
echo "<div id='gallery' class='gallery-root defaultDecoration' style='display: none;'>";
|
||||||
} else {
|
} else {
|
||||||
echo "<div id='gallery' class='gallery-root defaultDecoration' >";
|
echo "<div id='gallery' class='gallery-root defaultDecoration' >";
|
||||||
|
|
|
@ -101,7 +101,7 @@
|
||||||
?>
|
?>
|
||||||
<style>
|
<style>
|
||||||
.image-container, .fullscreen-image {
|
.image-container, .fullscreen-image {
|
||||||
background-color: <?php echo $image_colour; ?>55 !important;
|
background-color: <?php echo $image_colour; ?>33 !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<?php
|
<?php
|
||||||
|
|
105
index.php
105
index.php
|
@ -46,61 +46,72 @@
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="info-text defaultFonts">
|
|
||||||
<?php
|
|
||||||
// Set time for message
|
|
||||||
$time = date("H");
|
|
||||||
$timezone = date("e");
|
|
||||||
if ($time < "12") {
|
|
||||||
$time_welc = "Good morning";
|
|
||||||
} else if ($time >= "12" && $time < "17") {
|
|
||||||
$time_welc = "Good afternoon";
|
|
||||||
} else if ($time >= "17" && $time < "19") {
|
|
||||||
$time_welc = "Good evening";
|
|
||||||
} else if ($time >= "19") {
|
|
||||||
$time_welc = "Good night";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Welcome depending on if user is logged in or not
|
|
||||||
if (isset($_SESSION["username"])) {
|
|
||||||
echo "<h1>".$time_welc." ".$_SESSION['username']."!</h1>";
|
|
||||||
} else {
|
|
||||||
echo "<h1>".$time_welc."!</h1>";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Random welcome message
|
|
||||||
$welcome_message = $user_settings['welcome_msg'];
|
|
||||||
echo "<p>".$welcome_message[array_rand($welcome_message, 1)]."</p>";
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="gallery-root defaultDecoration">
|
|
||||||
<?php
|
<?php
|
||||||
// Reading images from table
|
// Reading images from table
|
||||||
$image_request = mysqli_query($conn, "SELECT * FROM images ORDER BY id DESC");
|
$image_request = mysqli_query($conn, "SELECT * FROM images ORDER BY id DESC");
|
||||||
|
|
||||||
while ($image = mysqli_fetch_array($image_request)) {
|
if (!empty($image_request)) {
|
||||||
// Getting thumbnail
|
?>
|
||||||
if (file_exists("images/thumbnails/".$image['imagename'])) {
|
<div class="info-text defaultFonts">
|
||||||
$image_path = "images/thumbnails/".$image['imagename'];
|
<?php
|
||||||
} else {
|
// Set time for message
|
||||||
$image_path = "images/".$image['imagename'];
|
$time = date("H");
|
||||||
|
$timezone = date("e");
|
||||||
|
if ($time < "12") {
|
||||||
|
$time_welc = "Good morning";
|
||||||
|
} else if ($time >= "12" && $time < "17") {
|
||||||
|
$time_welc = "Good afternoon";
|
||||||
|
} else if ($time >= "17" && $time < "19") {
|
||||||
|
$time_welc = "Good evening";
|
||||||
|
} else if ($time >= "19") {
|
||||||
|
$time_welc = "Good night";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Welcome depending on if user is logged in or not
|
||||||
|
if (isset($_SESSION["username"])) {
|
||||||
|
echo "<h1>".$time_welc." ".$_SESSION['username']."!</h1>";
|
||||||
|
} else {
|
||||||
|
echo "<h1>".$time_welc."!</h1>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Random welcome message
|
||||||
|
$welcome_message = $user_settings['welcome_msg'];
|
||||||
|
echo "<p>".$welcome_message[array_rand($welcome_message, 1)]."</p>";
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
echo "<div class='gallery-root defaultDecoration'>";
|
||||||
|
|
||||||
|
while ($image = mysqli_fetch_array($image_request)) {
|
||||||
|
// Getting thumbnail
|
||||||
|
if (file_exists("images/thumbnails/".$image['imagename'])) {
|
||||||
|
$image_path = "images/thumbnails/".$image['imagename'];
|
||||||
|
} else {
|
||||||
|
$image_path = "images/".$image['imagename'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for NSFW tag
|
||||||
|
if (str_contains($image['tags'], "nsfw")) {
|
||||||
|
echo "<div class='gallery-item'>
|
||||||
|
<a href='image.php?id=".$image['id']."' class='nsfw-warning'><img class='svg' src='assets/icons/warning_red.svg'><span>NSFW</span></a>
|
||||||
|
<a href='image.php?id=".$image['id']."'><img class='gallery-image nsfw-blur' loading='lazy' src='".$image_path."' id='".$image['id']."'></a>
|
||||||
|
</div>";
|
||||||
|
} else {
|
||||||
|
echo "<div class='gallery-item'>
|
||||||
|
<a href='image.php?id=".$image['id']."'><img class='gallery-image' loading='lazy' src='".$image_path."' id='".$image['id']."'></a>
|
||||||
|
</div>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for NSFW tag
|
echo "</div>";
|
||||||
if (str_contains($image['tags'], "nsfw")) {
|
} else {
|
||||||
echo "<div class='gallery-item'>
|
echo "<div class='info-text defaultFonts'>
|
||||||
<a href='image.php?id=".$image['id']."' class='nsfw-warning'><img class='svg' src='assets/icons/warning_red.svg'><span>NSFW</span></a>
|
<h1>Nothing here!</h1>
|
||||||
<a href='image.php?id=".$image['id']."'><img class='gallery-image nsfw-blur' loading='lazy' src='".$image_path."' id='".$image['id']."'></a>
|
<p>There are no images in the gallery, upload some!</p>
|
||||||
</div>";
|
</div>";
|
||||||
} else {
|
|
||||||
echo "<div class='gallery-item'>
|
|
||||||
<a href='image.php?id=".$image['id']."'><img class='gallery-image' loading='lazy' src='".$image_path."' id='".$image['id']."'></a>
|
|
||||||
</div>";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php require_once __DIR__."/assets/ui/footer.php"; ?>
|
<?php require_once __DIR__."/assets/ui/footer.php"; ?>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -44,6 +44,11 @@
|
||||||
.profile-root {
|
.profile-root {
|
||||||
background-image: linear-gradient(to right, <?php echo $pfp_colour; ?>, var(--bg-3), var(--bg-3)) !important;
|
background-image: linear-gradient(to right, <?php echo $pfp_colour; ?>, var(--bg-3), var(--bg-3)) !important;
|
||||||
}
|
}
|
||||||
|
@media (max-width: 669px) {
|
||||||
|
.profile-root {
|
||||||
|
background-image: linear-gradient(to bottom, <?php echo $pfp_colour; ?>, var(--bg-3)) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue