From 7b17d290940bc727723deed3f0f560b58cee2c88 Mon Sep 17 00:00:00 2001 From: Markus Koch Date: Tue, 2 Nov 2021 21:17:56 +0100 Subject: [PATCH] includeGraphics: Clean up thumbnail generation --- shared.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared.php b/shared.php index f1be203..d2795ac 100644 --- a/shared.php +++ b/shared.php @@ -6,7 +6,7 @@ define('HOME_PAGE', 'blog'); // Entry page (and link for logo) define('CACHE_POSTS_TTL', 3600); // Time to cache the posts list (1h) define('POSTS_BASE', "/b/"); // Root directory of the posts (relative) - define('YT_PREVIEW', "/b/pimg-yt/"); // Directory containing local copies of the youtube thumbnails + define('PREVIEW_BASE', "/pimg/"); // Directory to store auto-generated thumbnails define('POSTS_ROOT', $_SERVER['DOCUMENT_ROOT'] . POSTS_BASE); // Root directory of the posts (absolute) define('POSTS_PAGE_SIZE', 10); // Numbers of posts on a page @@ -75,7 +75,7 @@ } if ($preview == "+") { - $previewPath = POSTS_BASE . "pimg/" . str_replace("/", "_", $path); + $previewPath = PREVIEW_BASE . str_replace("/", "_", $path); $fpreviewPath = $_SERVER['DOCUMENT_ROOT'] . $previewPath; if (!file_exists($fpreviewPath)) { preg_match("/^[A-Za-z_\.\-0-9\/]*$/", $fpath, $matches); // SANITIZED! @@ -137,7 +137,7 @@ } else if (opted_in('y')) { echo ''; } else { - $preview_file = YT_PREVIEW . $youtube['vid'] . ".jpg"; + $preview_file = PREVIEW_BASE . $youtube['vid'] . ".jpg"; if (!file_exists($_SERVER['DOCUMENT_ROOT'] . $preview_file)) { file_put_contents($_SERVER['DOCUMENT_ROOT'] . $preview_file, file_get_contents("https://img.youtube.com/vi/" . $youtube['vid'] . "/maxresdefault.jpg")); }