Add debugging messages

This commit is contained in:
Jonah Lawrence 2023-12-26 20:20:33 +02:00
parent 540dba79b7
commit bd93f7ad69
No known key found for this signature in database
GPG Key ID: 613851A667DC08A3
1 changed files with 7 additions and 1 deletions

View File

@ -88,6 +88,12 @@ $images = json_decode(curlGetContents($GITHUB_API_URL, $REPO), true);
// if the random query string parameter is set, pick a random image
if (isset($_GET['random'])) {
// get the image url
if (empty($images)) {
exit("Error: images could not be parsed from GitHub API: " . print_r($images, true));
}
if (!is_array($images[array_rand($images)])) {
exit("Error: image was not an array: " . print_r($images[array_rand($images)], true));
}
$random_image_path = $images[array_rand($images)]["download_url"];
displayImage($random_image_path, $REPO, $redirect);
}