2022-07-21 14:53:04 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>UwU</title>
|
|
|
|
<link rel="stylesheet" href="css/master.css">
|
|
|
|
<link href="https://fonts.googleapis.com/css2?family=Rubik" rel="stylesheet">
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<?php
|
2022-07-23 07:44:43 +00:00
|
|
|
include("ui/header.php");
|
|
|
|
include_once("ui/conn.php");
|
2022-07-21 14:53:04 +00:00
|
|
|
|
2022-07-23 07:44:43 +00:00
|
|
|
// Get image ID
|
|
|
|
// Getting all image info from table
|
|
|
|
$get_image = "SELECT * FROM swag_table WHERE id = ".$_GET['id'];
|
|
|
|
$image_results = mysqli_query($conn, $get_image);
|
|
|
|
$image = mysqli_fetch_assoc($image_results);
|
2022-07-21 14:53:04 +00:00
|
|
|
|
2022-07-23 09:37:12 +00:00
|
|
|
if ($_GET["update"] == "success") {
|
|
|
|
echo "<p class='alert alert-high space-top'>Information updated</p>";
|
|
|
|
}
|
|
|
|
|
2022-07-23 07:44:43 +00:00
|
|
|
if (!isset($_GET['id'])) {
|
|
|
|
echo "<p class='alert alert-low'>No ID present</p>";
|
2022-07-21 22:14:56 +00:00
|
|
|
|
2022-07-23 07:44:43 +00:00
|
|
|
$image_path = "assets/no_image.png";
|
|
|
|
$image_alt = "No image could be found, sowwy";
|
|
|
|
} elseif (empty($image['imagename'])) {
|
|
|
|
echo "<p class='alert alert-low'>Could not find image with ID: ".$_GET['id']."</p>";
|
2022-07-21 14:53:04 +00:00
|
|
|
|
2022-07-23 07:44:43 +00:00
|
|
|
$image_path = "assets/no_image.png";
|
|
|
|
$image_alt = "No image could be found, sowwy";
|
|
|
|
} else {
|
|
|
|
$image_path = "images/".$image['imagename'];
|
|
|
|
$image_alt = $image['alt'];
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
<div class="image-container">
|
|
|
|
<?php echo "<img class='image' id='".$image['id']."' src='".$image_path."' alt='".$image_alt."'>"; ?>
|
2022-07-21 14:53:04 +00:00
|
|
|
</div>
|
|
|
|
|
2022-07-22 00:21:48 +00:00
|
|
|
<div class="image-description">
|
|
|
|
<h2>Description</h2>
|
|
|
|
<?php
|
2022-07-22 13:55:56 +00:00
|
|
|
// Image Description/Alt
|
2022-07-23 07:44:43 +00:00
|
|
|
if (empty($image_alt)) {
|
2022-07-23 09:37:12 +00:00
|
|
|
echo "<p>No description provided</p>";
|
2022-07-23 07:44:43 +00:00
|
|
|
}else{
|
|
|
|
echo "<p>".$image_alt."</p>";
|
2022-07-22 13:55:56 +00:00
|
|
|
}
|
|
|
|
|
2022-07-22 00:21:48 +00:00
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
|
2022-07-21 14:53:04 +00:00
|
|
|
<div class="image-detail flex-down">
|
2022-07-22 00:21:48 +00:00
|
|
|
<h2>Details</h2>
|
2022-07-21 14:53:04 +00:00
|
|
|
<?php
|
2022-07-22 13:55:56 +00:00
|
|
|
// Image ID
|
2022-07-21 14:53:04 +00:00
|
|
|
echo "<p>ID: ".$image['id']."</p>";
|
2022-07-22 13:55:56 +00:00
|
|
|
|
|
|
|
// File name
|
2022-07-21 14:53:04 +00:00
|
|
|
echo "<p>File Name: ".$image['imagename']."</p>";
|
2022-07-22 13:55:56 +00:00
|
|
|
|
|
|
|
// Image Upload date
|
2022-07-21 14:53:04 +00:00
|
|
|
echo "<p>Upload Date: ".$image['upload']."</p>";
|
2022-07-22 13:55:56 +00:00
|
|
|
|
|
|
|
// Image resolution
|
|
|
|
list($width, $height) = getimagesize($image_path);
|
|
|
|
echo "<p>Image resolution: ".$width."x".$height."</p>";
|
2022-07-21 14:53:04 +00:00
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="danger-zone flex-down">
|
|
|
|
<h2>Danger zone</h2>
|
2022-07-23 09:37:12 +00:00
|
|
|
<!-- DELETE BUTTON -->
|
2022-07-21 14:53:04 +00:00
|
|
|
<?php
|
|
|
|
// Image hover details
|
2022-07-21 18:42:03 +00:00
|
|
|
echo "<form class='detail' method='POST' enctype='multipart/form-data'>";
|
|
|
|
echo "<button class='btn alert-low' type='submit' name='delete' value='".$image['id']."'>Delete image</button>";
|
2022-07-21 14:53:04 +00:00
|
|
|
echo "</form>";
|
|
|
|
|
|
|
|
// Check if query is set
|
2022-07-21 18:42:03 +00:00
|
|
|
if (isset($_POST['delete'])) {
|
2022-07-21 14:53:04 +00:00
|
|
|
// Try deleting image
|
2022-07-21 18:42:03 +00:00
|
|
|
if(unlink("images/".$image['imagename'])) {
|
2022-07-21 14:53:04 +00:00
|
|
|
// If deleted, delete from Table
|
2022-07-21 18:42:03 +00:00
|
|
|
$image_delete_request = "DELETE FROM swag_table WHERE id =".$image['id'];
|
|
|
|
$image_delete = mysqli_query($conn,$image_delete_request);
|
|
|
|
if ($image_delete) {
|
2022-07-21 14:53:04 +00:00
|
|
|
// Deleted image
|
2022-07-21 18:42:03 +00:00
|
|
|
header("Location:index.php?del=true&id=".$image['id']);
|
2022-07-21 14:53:04 +00:00
|
|
|
}
|
2022-07-23 07:44:43 +00:00
|
|
|
} else {
|
2022-07-21 14:53:04 +00:00
|
|
|
// Could not delete from file
|
2022-07-21 18:42:03 +00:00
|
|
|
echo "<p class='alert alert-fail' id='deleted'>Error: Coult not delete image</p>";
|
2022-07-21 14:53:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
2022-07-23 09:37:12 +00:00
|
|
|
|
|
|
|
<!-- EDIT BUTTON -->
|
|
|
|
<?php echo "<a class='btn alert-low space-top' href='https://superdupersecteteuploadtest.fluffybean.gay/edit.php?id=".$image['id']."'>Modify image content</a>"; ?>
|
2022-07-21 14:53:04 +00:00
|
|
|
</div>
|
|
|
|
|
2022-07-23 07:44:43 +00:00
|
|
|
<?php include("ui/footer.php"); ?>
|
2022-07-21 14:53:04 +00:00
|
|
|
</body>
|
|
|
|
</html>
|