aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSquibid <me@zacharyscheiman.com>2023-10-09 09:01:06 -0400
committerSquibid <me@zacharyscheiman.com>2023-10-09 09:01:06 -0400
commit5c80111da6c30bf8daca6bd7e880b29d7b33f8ba (patch)
treeb2890ba4f770a1f8b0751059a664f8833f9d31b7
parent16cb41ee3920c12a27c3009543d1cc7a3573e9e7 (diff)
downloadwallheaven-5c80111da6c30bf8daca6bd7e880b29d7b33f8ba.tar.gz
wallheaven-5c80111da6c30bf8daca6bd7e880b29d7b33f8ba.tar.bz2
wallheaven-5c80111da6c30bf8daca6bd7e880b29d7b33f8ba.zip
better meta tags + image previews
Diffstat (limited to '')
-rw-r--r--style/header.php12
-rw-r--r--view.php3
2 files changed, 12 insertions, 3 deletions
diff --git a/style/header.php b/style/header.php
index 79a4479..0e3f832 100644
--- a/style/header.php
+++ b/style/header.php
@@ -8,9 +8,15 @@
$_GET["Anime"] ? $Anime = "checked" : $Anime = NULL;
$_GET["People"] ? $People = "checked" : $People = NULL;
- printf("<head>\n<title>WallHeaven - %s</title>\n", $_GET["q"]);
- printf("<meta name='description' content='Pictures of %s'>\n", $_GET["q"]);
- echo <<<GFG
+ if ($_GET["q"]) {
+ printf("<head>\n<title>WallHeaven - %s</title>\n", $_GET["q"]);
+ 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">
<link rel="stylesheet" href="/style/style.css">
<meta charset="utf-8">
diff --git a/view.php b/view.php
index 697a7a9..5b8c5aa 100644
--- a/view.php
+++ b/view.php
@@ -17,6 +17,9 @@
$wall = getwallpaper("https://wallhaven.cc/api/v1/w/$_GET[w]?apikey=$apikey");
$_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 */
preg_match("/(?!.*-)([A-Za-z0-9]+)/", $_POST['wall'], $matches);
if ($_POST['purity'] === "nsfw")