mirror of
https://github.com/Anvilcraft/jensmemes
synced 2024-11-12 13:01:30 +01:00
Added random api
This commit is contained in:
parent
578c7b9df8
commit
f5f76f18fa
2 changed files with 19 additions and 0 deletions
12
website/random.php
Normal file
12
website/random.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
$files = glob("images/*/*");
|
||||
$random = rand(0, count($files) - 1);
|
||||
$file = $files[$random];
|
||||
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
|
||||
if ($ext == "mp4") {
|
||||
echo '<a href="' . $file . '"><video src=' . $file . ' controls ></video></a>';
|
||||
} else {
|
||||
echo "<a href='$file'><img src='$file' /></a>";
|
||||
}
|
||||
?>
|
||||
|
7
website/randomapi.php
Normal file
7
website/randomapi.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
$files = glob("images/*/*");
|
||||
$random = rand(0, count($files) - 1);
|
||||
$file = $files[$random];
|
||||
echo "https://jensmemes.tilera.xyz/" . $file;
|
||||
?>
|
||||
|
Loading…
Reference in a new issue