mirror of
https://github.com/Fluffy-Bean/image-gallery.git
synced 2025-06-05 09:53:12 +00:00
Cleaned up some stuffs in profile and upload
This commit is contained in:
parent
956758fa25
commit
7f2e01a7f1
3 changed files with 55 additions and 55 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -2,4 +2,6 @@
|
|||
images/
|
||||
|
||||
# CSS map, I don't think its needed for upload... I think?
|
||||
*.map
|
||||
*.map
|
||||
|
||||
.idea/
|
28
profile.php
28
profile.php
|
@ -10,8 +10,8 @@
|
|||
$diff = new Diff();
|
||||
|
||||
if (!isset($_GET['user']) || empty($_GET['user'])) {
|
||||
header("Location: index.php");
|
||||
} elseif (isset($_GET['user'])) {
|
||||
header("Location: index.php");
|
||||
} else if (isset($_GET['user'])) {
|
||||
$user = $user_info->get_user_info($conn, $_GET['user']);
|
||||
|
||||
$join_date = new DateTime($user['created_at']);
|
||||
|
@ -34,11 +34,7 @@
|
|||
echo "<img src='images/pfp/".$user['pfp_path']."'>";
|
||||
|
||||
$pfp_colour = $make_stuff->get_image_colour("images/pfp/".$user['pfp_path']);
|
||||
if (!empty($pfp_colour)) {
|
||||
$pfp_colour = $pfp_colour;
|
||||
} else {
|
||||
$pfp_colour = "var(--bg-3)";
|
||||
}
|
||||
if (empty($pfp_colour)) $pfp_colour = "var(--bg-3)";
|
||||
?>
|
||||
<style>
|
||||
.profile-root {
|
||||
|
@ -58,7 +54,9 @@
|
|||
<h2>
|
||||
<?php
|
||||
echo $user['username'];
|
||||
if ($user_info->is_admin($conn, $user['id'])) echo "<span style='color: var(--accent); font-size: 16px; margin-left: 0.5rem;'>Admin</span>";
|
||||
if ($user_info->is_admin($conn, $user['id'])) {
|
||||
echo "<span style='color: var(--accent); font-size: 16px; margin-left: 0.5rem;'>Admin</span>";
|
||||
}
|
||||
?>
|
||||
</h2>
|
||||
<div class="profile-info">
|
||||
|
@ -69,7 +67,7 @@
|
|||
<?php
|
||||
} else {
|
||||
echo "<img src='assets/no_image.png'>
|
||||
<h2>Failed to load user info</h2>";
|
||||
<h2>Failed to load user info</h2>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
@ -94,20 +92,20 @@
|
|||
while ($image = mysqli_fetch_array($query)) {
|
||||
// Getting thumbnail
|
||||
if (file_exists("images/thumbnails/".$image['imagename'])) {
|
||||
$image_path = "images/thumbnails/".$image['imagename'];
|
||||
$image_path = "images/thumbnails/" . $image['imagename'];
|
||||
} else {
|
||||
$image_path = "images/".$image['imagename'];
|
||||
$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>";
|
||||
<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>
|
||||
<a href='image.php?id=" . $image['id'] . "'><img class='gallery-image' loading='lazy' src='" . $image_path . "' id='" . $image['id'] . "'></a>
|
||||
</div>";
|
||||
}
|
||||
}
|
||||
|
|
78
upload.php
78
upload.php
|
@ -18,7 +18,7 @@
|
|||
if (!$user_info->is_loggedin()) {
|
||||
?>
|
||||
<script>
|
||||
sniffleAdd('Who are you!', 'You must be loggedin to upload things, sowwy!', 'var(--alert)', 'assets/icons/cross.svg');
|
||||
sniffleAdd('Who are you!', 'You must be logged in to upload things, sowwy!', 'var(--alert)', 'assets/icons/cross.svg');
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
@ -50,49 +50,49 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
$("#uploadSubmit").submit(function(event) {
|
||||
$('#uploadSubmit').submit(function(event) {
|
||||
event.preventDefault();
|
||||
// Check if image avalible
|
||||
// Check if image available
|
||||
var file = $("#image").val();
|
||||
if (file != "") {
|
||||
// Make form
|
||||
var formData = new FormData();
|
||||
if (file == "") {
|
||||
sniffleAdd('Gwha!', 'Pls provide image', 'var(--warning)', 'assets/icons/file-search.svg');
|
||||
} else {
|
||||
// Make form
|
||||
var formData = new FormData();
|
||||
|
||||
// Get image
|
||||
var image_data = $("#image").prop("files")[0];
|
||||
formData.append("image", image_data);
|
||||
// Get ALT
|
||||
var alt = $("#alt").val();
|
||||
formData.append("alt", alt);
|
||||
// Get TAGS
|
||||
var tags = $("#tags").val();
|
||||
formData.append("tags", tags);
|
||||
// Submit data
|
||||
var submit = $("#submit").val();
|
||||
formData.append("submit", submit);
|
||||
// Get image
|
||||
var image_data = $("#image").prop("files")[0];
|
||||
formData.append("image", image_data);
|
||||
// Get ALT
|
||||
var alt = $("#alt").val();
|
||||
formData.append("alt", alt);
|
||||
// Get TAGS
|
||||
var tags = $("#tags").val();
|
||||
formData.append("tags", tags);
|
||||
// Submit data
|
||||
var submit = $("#submit").val();
|
||||
formData.append("submit", submit);
|
||||
|
||||
// Upload the information
|
||||
$.ajax({
|
||||
url: 'app/image/upload_image.php',
|
||||
type: 'post',
|
||||
data: formData,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function(response) {
|
||||
$("#newSniff").html(response);
|
||||
}
|
||||
});
|
||||
// Upload the information
|
||||
$.ajax({
|
||||
url: 'app/image/upload_image.php',
|
||||
type: 'post',
|
||||
data: formData,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function (response) {
|
||||
$("#newSniff").html(response);
|
||||
}
|
||||
});
|
||||
|
||||
// Empty values
|
||||
imagePreview.src = "";
|
||||
$("#image").val("");
|
||||
$("#alt").val("");
|
||||
$("#tags").val("");
|
||||
$("#submit").val("");
|
||||
} else {
|
||||
sniffleAdd('Gwha!', 'Pls provide image', 'var(--warning)', 'assets/icons/file-search.svg');
|
||||
}
|
||||
});
|
||||
// Empty values
|
||||
imagePreview.src = "";
|
||||
$("#image").val("");
|
||||
$("#alt").val("");
|
||||
$("#tags").val("");
|
||||
$("#submit").val("");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php require_once __DIR__."/assets/ui/footer.php"; ?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue