5
1
Fork 0
mirror of https://github.com/Anvilcraft/jensmemes synced 2024-11-21 18:35:57 +01:00

Port random.php to new api

This commit is contained in:
Timo Ley 2020-08-13 14:02:25 +02:00
parent 32a2a000d5
commit 2c6914ecdf
2 changed files with 4 additions and 7 deletions

View file

@ -1,7 +1,7 @@
<?php
$files = glob("images/*/*");
$random = rand(0, count($files) - 1);
$file = $files[$random];
$json = file_get_contents("https://jensmemes.tilera.xyz/api.php/random");
$obj = json_decode($json, false, 512, JSON_UNESCAPED_UNICODE);
$file = $obj->link;
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
if ($ext == "mp4") {
echo "<a href='$file'><video src='$file' controls ></video></a>";

View file

@ -1,6 +1,3 @@
<?php
$files = glob("images/*/*");
$random = rand(0, count($files) - 1);
$file = $files[$random];
echo "https://jensmemes.tilera.xyz/" . $file;
echo "Deprecated API. Use: https://jensmemes.tilera.xyz/api.php/random"
?>