better meta tags + image previews

This commit is contained in:
2023-10-09 09:01:06 -04:00
parent 16cb41ee39
commit 5c80111da6
2 changed files with 12 additions and 3 deletions

View File

@ -8,9 +8,15 @@
$_GET["Anime"] ? $Anime = "checked" : $Anime = NULL; $_GET["Anime"] ? $Anime = "checked" : $Anime = NULL;
$_GET["People"] ? $People = "checked" : $People = NULL; $_GET["People"] ? $People = "checked" : $People = NULL;
printf("<head>\n<title>WallHeaven - %s</title>\n", $_GET["q"]); if ($_GET["q"]) {
printf("<meta name='description' content='Pictures of %s'>\n", $_GET["q"]); printf("<head>\n<title>WallHeaven - %s</title>\n", $_GET["q"]);
echo <<<GFG printf("<meta name='description' content='Pictures of %s'>\n", $_GET["q"]);
} else {
printf("<head>\n<title>WallHeaven - Viewing A Wallpaper</title>\n", $_GET["w"]);
printf("<meta name='description' content='Wallpaper id:%s'>\n", $_GET["w"]);
}
?>
<meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="/style/style.css"> <link rel="stylesheet" href="/style/style.css">
<meta charset="utf-8"> <meta charset="utf-8">

View File

@ -17,6 +17,9 @@
$wall = getwallpaper("https://wallhaven.cc/api/v1/w/$_GET[w]?apikey=$apikey"); $wall = getwallpaper("https://wallhaven.cc/api/v1/w/$_GET[w]?apikey=$apikey");
$_POST['wall'] = $wall["path"]; $_POST['wall'] = $wall["path"];
} }
/* set meta tag */
printf("<meta property='twitter:image:src' content='/proxy.php?i=%s'>", $_POST['wall']);
printf("<meta property='twitter:card' content='summary_large_image'>");
/* get wallpaper id and get info from api */ /* get wallpaper id and get info from api */
preg_match("/(?!.*-)([A-Za-z0-9]+)/", $_POST['wall'], $matches); preg_match("/(?!.*-)([A-Za-z0-9]+)/", $_POST['wall'], $matches);
if ($_POST['purity'] === "nsfw") if ($_POST['purity'] === "nsfw")