diff --git a/api/index.php b/api/index.php index 6f19d72..bdcf7b8 100644 --- a/api/index.php +++ b/api/index.php @@ -80,12 +80,12 @@ if (preg_match("/\/images\/(.*)$/", $_SERVER['REQUEST_URI'], $matches)) { } // fetch the list of images from GitHub -$images = json_decode(curlGetContents($GITHUB_API_URL, $REPO)); +$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 - $random_image_path = $images[array_rand($images)]->download_url; + $random_image_path = $images[array_rand($images)]["download_url"]; displayImage($random_image_path, $REPO, $redirect); } ?> @@ -225,7 +225,7 @@ if (isset($_GET['random'])) {