mirror of
https://github.com/Fluffy-Bean/image-gallery.git
synced 2024-12-29 10:56:12 +00:00
Added Description
This commit is contained in:
parent
7077c44e84
commit
674a25dcba
|
@ -40,6 +40,7 @@
|
||||||
echo "<p>ID: ".$image['id']."</p>";
|
echo "<p>ID: ".$image['id']."</p>";
|
||||||
echo "<p>File Name: ".$image['imagename']."</p>";
|
echo "<p>File Name: ".$image['imagename']."</p>";
|
||||||
echo "<p>Upload Date: ".$image['upload']."</p>";
|
echo "<p>Upload Date: ".$image['upload']."</p>";
|
||||||
|
echo "<p>Description: ".$image['alt']."</p>";
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
14
upload.php
14
upload.php
|
@ -11,10 +11,13 @@
|
||||||
<?php include('ui/header.php'); ?>
|
<?php include('ui/header.php'); ?>
|
||||||
|
|
||||||
<div class="upload-root">
|
<div class="upload-root">
|
||||||
<form class="flex-left between" method="POST" action="upload.php" enctype="multipart/form-data">
|
<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">
|
<input class="btn alert-default" type="file" name="image" placeholder="select image UwU">
|
||||||
<hr class="space-small">
|
<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">
|
||||||
|
<hr class="space-small">
|
||||||
<button class="btn alert-default" type="submit" name="upload">Upload Image</button>
|
<button class="btn alert-default" type="submit" name="upload">Upload Image</button>
|
||||||
|
<hr class="space-small">
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
if ($_GET["r"] == "success") {
|
if ($_GET["r"] == "success") {
|
||||||
|
@ -42,12 +45,19 @@
|
||||||
// Get image name
|
// Get image name
|
||||||
$get_image_name = $_FILES['image']['name'];
|
$get_image_name = $_FILES['image']['name'];
|
||||||
|
|
||||||
|
// Get alt text
|
||||||
|
if ($_POST['alt'] != "") {
|
||||||
|
$get_alt_text = $_POST['alt'];
|
||||||
|
}else{
|
||||||
|
$get_alt_text = "No description provided";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// If image present, continue
|
// If image present, continue
|
||||||
if ($get_image_name != "") {
|
if ($get_image_name != "") {
|
||||||
// Set file path for image upload
|
// Set file path for image upload
|
||||||
$image_path = "images/".basename($get_image_name);
|
$image_path = "images/".basename($get_image_name);
|
||||||
$sql = "INSERT INTO swag_table (imagename) VALUES ('$get_image_name')";
|
$sql = "INSERT INTO swag_table (imagename, alt) VALUES ('$get_image_name','$get_alt_text')";
|
||||||
|
|
||||||
|
|
||||||
// Uploading image to Table
|
// Uploading image to Table
|
||||||
|
|
Loading…
Reference in a new issue