Test if media_upload is set, and halt if not

This commit is contained in:
sørenpeter 2025-02-23 08:58:26 +01:00
parent a02edfd7c5
commit e2c082a14a
2 changed files with 5 additions and 2 deletions

View file

@ -24,7 +24,8 @@ site_title = "Timeline"
txt_file_path = "twtxt.txt"
; Path to folder where you want to upload images for your posts
img_upload_dir = "./media"
media_upload = "../twtxt"
public_media = "https://darch.dk/twtxt"
; Full URL for your public twtxt.txt file
public_txt_url = "https://example.com/timeline/twtxt.txt"

View file

@ -8,6 +8,8 @@ $title = "Upload - $title";
include_once 'partials/header.php';
if(!isset($config["media_upload"])) exit("<p class='notice'>The path for <code>media_upload</code> is not set in your <code>config.ini</code></p>");
$media_upload = getcwd() . "/" . $config["media_upload"] . "/";
?>
@ -148,7 +150,7 @@ foreach ($imgs_on_server as $img) {
*/
echo '<section class="upload-grid">';
echo '<code>![]('.$public_file.')</code>';
echo '<a href="'.$public_file.'"><img src="'.$public_file.'"></a>';
echo '<a href="'.$public_file.'"><img src="'.$public_file.'" loading="lazy"></a>';
echo '</section>';
}