Link previews with generated header

This commit is contained in:
Michał 2022-09-23 09:15:16 +00:00
parent 3110858151
commit 410a8f8943
5 changed files with 39 additions and 14 deletions

View file

@ -1,10 +1,32 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php
// Get image info for image meta
if ( basename($_SERVER['PHP_SELF']) == "image.php") {
$image = $image_info->get_image_info($conn, $_GET['id']);
}
?>
<!-- Auto generated header tags -->
<title><?php echo $user_settings['website_name']; ?></title>
<meta name="description" content="<?php echo $user_settings['website_description']; ?>"/>
<meta name="keywords" content="Image, Gallery"/>
<meta name="author" content="<?php echo $user_settings['user_name']; ?>"/>
<!-- OG -->
<meta property="og:title" content="<?php echo $user_settings['website_name']; ?>"/>
<meta property="og:description" content="<?php echo $user_settings['website_description']; ?>"/>
<meta property="og:image" content="<?php echo "images/".$image['imagename']; ?>"/>
<meta property="og:type" content="website"/>
<meta name="theme-color" content="#8C977D">
<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:description" content="<?php echo $user_settings['website_description']; ?>">/
<meta name="twitter:title" content="<?php echo $user_settings['website_name']; ?>"/>
<!-- Stylesheets -->
<link rel="stylesheet" href="css/main.css">
<!-- Google Fonts -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Lexend+Deca:wght@600">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Secular+One&display=swap">

View file

@ -709,7 +709,7 @@ nav .btn {
.upload-root > img {
margin: 0 auto;
max-width: 100%;
max-height: 20rem;
max-height: 15rem;
border-radius: -0.3rem;
display: flex;
flex-direction: column;

View file

@ -487,7 +487,7 @@
margin: 0 auto;
max-width: 100%;
max-height: 20rem;
max-height: 15rem;
border-radius: calc($rad - 0.7rem);

View file

@ -1,4 +1,14 @@
<?php require_once __DIR__."/app/required.php"; ?>
<?php
require_once __DIR__."/app/required.php";
use App\Account;
use App\Image;
use App\Diff;
$image_info = new Image;
$user_info = new Account;
$diff = new Diff();
?>
<!DOCTYPE html>
<html>
@ -11,14 +21,6 @@
<?php
require_once __DIR__."/assets/ui/nav.php";
use App\Account;
use App\Image;
use App\Diff;
$image_info = new Image;
$user_info = new Account;
$diff = new Diff();
/*
|-------------------------------------------------------------
| Get image ID
@ -27,12 +29,12 @@
| If ID cannot be obtained, give error. ID going here ^^
|-------------------------------------------------------------
*/
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
if (isset($_GET['id'])) {
// Get all image info
$image = $image_info->get_image_info($conn, $_GET['id']);
// Check if image is avalible
if (isset($image['imagename'])) {
if (!empty($image['imagename']) && isset($image['imagename'])) {
$image_present = True;
} else {
?>

View file

@ -84,6 +84,7 @@
});
// Empty values
imagePreview.src = "";
$("#image").val("");
$("#alt").val("");
$("#tags").val("");