Requested album links as js array (in subarrays to allow future metadata
addition) for use by dashboard page.
$title = array_pop($nav);
$Page->title = ($nav ? implode(' ', $nav) . ': ' : '') . $title;
$title = array_pop($nav);
$Page->title = ($nav ? implode(' ', $nav) . ': ' : '') . $title;
+if ($_SERVER['HTTP_ACCEPT'] === 'application/json') {
+ header('Access-Control-Allow-Origin: *');
+ $imgs = [];
+ foreach (glob("$rootdir/*.jpg") as $path) {
+ $target = preg_replace('{^(\.\./)*}', '', readlink($path));
+ $imgs[] = ["/$target"];
+ }
+ print json_encode($imgs);
+ exit;
+}
+elseif ($Page->api) {
$img = "$rootdir/index.jpg";
if (file_exists($img)) {
# cover image of current album
$img = "$rootdir/index.jpg";
if (file_exists($img)) {
# cover image of current album