Skip to content

Instantly share code, notes, and snippets.

@digiltd
Last active July 1, 2016 15:33
Show Gist options
  • Save digiltd/b9bdd00fa232bfbdd3c775015218de75 to your computer and use it in GitHub Desktop.
Save digiltd/b9bdd00fa232bfbdd3c775015218de75 to your computer and use it in GitHub Desktop.
Random background image selected from a folder containing an unknown amount of images
<?php
$files = glob('images/*.*');
$file = array_rand($files);
?>
<html>
<head>
<style type="text/css">
body {
background-size: cover;
background-position: center;
background-image: url("/pihole/<?php echo $files[$file]; ?>");
padding: 0;
margin: 0;
}
</style>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment