2015-02-06 21:31:43 +01:00
|
|
|
<?php
|
|
|
|
// Indicate the location of your images
|
|
|
|
$root = '';
|
|
|
|
// use if specifying path from root
|
|
|
|
//$root = $_SERVER['DOCUMENT_ROOT'];
|
|
|
|
|
|
|
|
$path = 'images/';
|
|
|
|
|
|
|
|
function getImagesFromDir($path) {
|
2015-02-12 22:35:31 +01:00
|
|
|
$images = array();
|
|
|
|
if ( $img_dir = @opendir($path) ) {
|
|
|
|
while ( false !== ($img_file = readdir($img_dir)) ) {
|
|
|
|
// checks for gif, jpg, png and jpeg
|
|
|
|
if ( preg_match("/(\.gif|\.jpg|\.png\.jpeg)$/", $img_file) ) {
|
|
|
|
$images[] = $img_file;
|
|
|
|
}
|
2015-02-06 21:31:43 +01:00
|
|
|
}
|
2015-02-12 22:35:31 +01:00
|
|
|
closedir($img_dir);
|
|
|
|
}
|
|
|
|
return $images;
|
2015-02-06 21:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function getRandomFromArray($ar) {
|
2015-02-12 22:35:31 +01:00
|
|
|
mt_srand( (double)microtime() * 1000000 ); // php 4.2+ not needed
|
|
|
|
$num = array_rand($ar);
|
|
|
|
return $ar[$num];
|
2015-02-06 21:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Obtain list of images from directory
|
|
|
|
$imgList = getImagesFromDir($root . $path);
|
|
|
|
$img = getRandomFromArray($imgList);
|
2015-02-12 22:35:31 +01:00
|
|
|
|
2015-02-06 21:31:43 +01:00
|
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
2015-02-06 22:12:55 +01:00
|
|
|
<html>
|
2015-02-12 22:35:31 +01:00
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
2020-08-14 20:31:22 +02:00
|
|
|
<title>Yagyuu</title>
|
2015-02-12 22:35:31 +01:00
|
|
|
<link rel="stylesheet" href="style.css">
|
|
|
|
<link rel="shortcut icon" href="favicon.ico" />
|
|
|
|
</head>
|
2020-08-14 20:31:22 +02:00
|
|
|
|
2015-02-12 22:35:31 +01:00
|
|
|
<body>
|
2015-02-27 20:59:37 +01:00
|
|
|
<div class="text-center"><p style="font-size:xx-large;">Press F5 for another pic!</p></div>
|
2015-02-12 22:35:31 +01:00
|
|
|
<!-- image displays here -->
|
|
|
|
<div class="pic-center">
|
2020-08-14 20:31:22 +02:00
|
|
|
<img src="<?php echo $path . $img ?>" height="700" alt="Cute Yagyuu <3" />
|
2015-02-12 22:35:31 +01:00
|
|
|
</div>
|
|
|
|
</body>
|
2020-08-14 20:31:22 +02:00
|
|
|
|
|
|
|
<!-- Footer begins -->
|
|
|
|
<a href="sources.php">Sources</a> | <a href="yagyuu.zip">Download all pictures</a> | <a href="https://riko.moe" target="_blank">Riko.moe</a> | <a href="mailto:miku2000@outlook.de?subject=[Yagyuu.moe]">Mail me</a>
|
|
|
|
<!-- Footer ends -->
|
|
|
|
|
2015-02-06 22:12:55 +01:00
|
|
|
</html>
|