<?php
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$jsonPath = "db/bg_rev_" . $id . ".json";
$imagePath = "";
if ($id > 0 && file_exists($jsonPath)) {
    $data = json_decode(file_get_contents($jsonPath), true);
    if (!empty($data[0]['ImageName'])) {
        $img = $data[0]['ImageName'];
        $imagePath = (filter_var($img, FILTER_VALIDATE_URL)) ? $img : "../" . $img;
    }
}
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <style>
        * { margin:0; padding:0; -webkit-touch-callout:none; -webkit-user-select:none; user-select:none; }
        html, body { width:100%; height:100%; background:transparent !important; overflow:hidden; position:fixed; }
        .bg { width:100%; height:100%; background-image:url('<?= $imagePath ?>?v=<?= time() ?>'); background-size:cover; background-position:center; background-repeat:no-repeat; pointer-events:none; }
    </style>
</head>
<body><?php if($imagePath): ?><div class="bg"></div><?php endif; ?></body>
</html>
