mirror of
https://github.com/Fluffy-Bean/image-gallery.git
synced 2025-05-29 06:43:11 +00:00
World shittest gallery implementation 😳
This commit is contained in:
parent
6d3012a4f7
commit
e19bab45cd
7 changed files with 273 additions and 19 deletions
42
index.php
42
index.php
|
@ -1,4 +1,10 @@
|
|||
<?php require_once __DIR__."/app/required.php"; ?>
|
||||
<?php
|
||||
require_once __DIR__."/app/required.php";
|
||||
|
||||
use App\Image;
|
||||
|
||||
$image_info = new Image;
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
@ -48,6 +54,40 @@
|
|||
?>
|
||||
</div>
|
||||
|
||||
<div class="gallery-root">
|
||||
<?php
|
||||
// Reading images from table
|
||||
$group_list = mysqli_query($conn, "SELECT * FROM groups ORDER BY id DESC");
|
||||
|
||||
foreach ($group_list as $group) {
|
||||
$image_list = array_reverse(explode(" ", $group['image_list']));
|
||||
$image = $image_info->get_image_info($conn, $image_list[array_rand($image_list, 1)]);
|
||||
|
||||
// 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 group-item'>
|
||||
<a href='group.php?id=".$group['id']."' class='nsfw-warning gallery-group'><img class='svg' src='assets/icons/warning_red.svg'><span>NSFW</span></a>
|
||||
<a href='group.php?id=".$group['id']."'><img class='gallery-image nsfw-blur' loading='lazy' src='".$image_path."' id='".$group['id']."'></a>
|
||||
<p class='group-name'>".$group['group_name']."</p>
|
||||
</div>";
|
||||
} else {
|
||||
echo "<div class='gallery-item group-item'>
|
||||
<a href='group.php?id=".$group['id']."' class='gallery-group'></a>
|
||||
<a href='group.php?id=".$group['id']."'><img class='gallery-image' loading='lazy' src='".$image_path."' id='".$group['id']."'></a>
|
||||
<p class='group-name'>".$group['group_name']."</p>
|
||||
</div>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="gallery-root">
|
||||
<?php
|
||||
// Reading images from table
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue