I have no clue what I added here

This commit is contained in:
Michał 2022-07-21 23:14:56 +01:00
parent 674a25dcba
commit 310510b686
4 changed files with 14 additions and 8 deletions

BIN
assets/no_image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View file

@ -179,7 +179,7 @@ form {
background-color: var(--gray);
border-radius: var(--rad);
flex: 1 0 150px;
flex: 1 0 170px;
transition: transform 0.15s cubic-bezier(.19,1,.22,1);
}
@ -194,7 +194,7 @@ form {
}
.gallery-item:hover {
transform: scale(1.1);
transform: scale(1.1) rotate(5deg);
box-shadow:0 0 5px var(--dark-gray);
}

View file

@ -27,7 +27,15 @@
$image_results = mysqli_query($conn, $get_image);
$image = mysqli_fetch_assoc($image_results);
echo "<img class='image' src='images/".$image['imagename']."' id='".$image['id']."'>";
if ($image['imagename'] != "") {
$image_name = "images/".$image['imagename'];
$image_alt = $image['alt'];
}else{
$image_name = "assets/no_image.png";
$image_alt = "No image could be found, sowwy";
}
echo "<img class='image' id='".$image['id']."' src='".$image_name."' alt='".$image_alt."'>";
if (!isset($_GET['id'])) {
echo "cannot obtain image";
@ -40,7 +48,7 @@
echo "<p>ID: ".$image['id']."</p>";
echo "<p>File Name: ".$image['imagename']."</p>";
echo "<p>Upload Date: ".$image['upload']."</p>";
echo "<p>Description: ".$image['alt']."</p>";
echo "<p>Description: ".$image_alt."</p>";
?>
</div>

View file

@ -14,7 +14,7 @@
<form class="flex-down between" method="POST" action="upload.php" enctype="multipart/form-data">
<input class="btn alert-default" type="file" name="image" placeholder="select image UwU">
<hr class="space-small">
<input class="btn" type="text" name="alt" placeholder="Enter a description for image, this will also be used as an alt">
<input class="btn" type="text" name="alt" placeholder="Description/Alt for image">
<hr class="space-small">
<button class="btn alert-default" type="submit" name="upload">Upload Image</button>
<hr class="space-small">
@ -27,7 +27,7 @@
}elseif ($_GET["r"] == "nofile") {
echo "<p class='alert alert-default'>No file lol</p>";
}else{
echo "<p class='alert alert-default'>Select an image to upload</p>";
// echo "<p class='alert alert-default'>Select an image to upload</p>";
}
?>
</div>
@ -67,10 +67,8 @@
// Checking if image uploaded
if (move_uploaded_file($_FILES['image']['tmp_name'], $image_path)) {
header("Location:upload.php?r=success");
}else{
header("Location:upload.php?r=fail");
}
}else{
// No image present