summaryrefslogtreecommitdiff
path: root/albumart.php
blob: 0a7e445151953c44723a8403b1869b5b6c3b33e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php

$songs = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/assets/content/songs.json"), true);
$albums = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/assets/content/albums.json"), true);

if (!isset($_GET["i"]) || (!isset($songs[$_GET["i"]]) && !isset($albums[$_GET["i"]]))) {
    die();
}

header("Cache-Control: public, max-age=604800, immutable");
header("Content-Type: image/jpeg");
header("Content-Length: " . filesize($_SERVER['DOCUMENT_ROOT'] . "/assets/content/" . $_GET["i"] . ".jpg"));
readfile($_SERVER['DOCUMENT_ROOT'] . "/assets/content/" . $_GET["i"] . ".jpg");