get_bilder.php hinzugefügt
This commit is contained in:
29
galerie/get_bilder.php
Normal file
29
galerie/get_bilder.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
header("Access-Control-Allow-Origin: *");
|
||||||
|
|
||||||
|
if(!isset($_GET["ev"])) die("GET ev fehlt");
|
||||||
|
$ev=$_GET["ev"];
|
||||||
|
|
||||||
|
if(!isset($_GET["jahr"])) die("GET jahr fehlt");
|
||||||
|
$jahr=$_GET["jahr"];
|
||||||
|
|
||||||
|
if(str_contains($ev, "/")) die("GET ev ungültig");
|
||||||
|
if(str_contains($jahr, "/")) die("GET jahr ungültig");
|
||||||
|
|
||||||
|
$path="../../bilder/".$ev."/".$jahr;
|
||||||
|
|
||||||
|
$bilder=scandir($path);
|
||||||
|
|
||||||
|
$file_extension_whitelist=["jpg","jpeg","png","gif"];
|
||||||
|
|
||||||
|
$result=[];
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($bilder as $key => $value) {
|
||||||
|
if (is_dir($path."/".$value)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(in_array(pathinfo($path."/".$value,PATHINFO_EXTENSION),$file_extension_whitelist)) $result[] = "/".$ev."/".$jahr."/".$value;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($result,JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);
|
||||||
Reference in New Issue
Block a user