Riko.moe/index.php

56 lines
1.5 KiB
PHP
Raw Normal View History

2015-02-28 21:48:37 +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) {
$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;
}
}
closedir($img_dir);
}
return $images;
}
function getRandomFromArray($ar) {
mt_srand( (double)microtime() * 1000000 ); // php 4.2+ not needed
$num = array_rand($ar);
return $ar[$num];
}
// Obtain list of images from directory
$imgList = getImagesFromDir($root . $path);
$img = getRandomFromArray($imgList);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
2017-06-21 19:50:36 +02:00
<title>Riko.moe</title>
2015-02-28 21:48:37 +01:00
<link rel="stylesheet" href="style.css">
2017-06-21 19:50:36 +02:00
<link rel="shortcut icon" href="favicon.ico" />
2015-02-28 21:48:37 +01:00
</head>
2017-06-21 19:50:36 +02:00
2015-02-28 21:48:37 +01:00
<body>
<div class="text-center"><p style="font-size:xx-large;">Press F5 for another pic!</p></div>
<!-- image displays here -->
<div class="pic-center">
<img src="<?php echo $path . $img ?>" alt="" />
</div>
</body>
2017-06-21 19:50:36 +02:00
<!-- Footer begins -->
2018-05-15 17:55:29 +02:00
<a href="sources.php">Sources</a> | <a href="riko.zip">Download all pictures</a> | <a href="https://yagyuu.moe" target="_blank">Yagyuu.moe</a> | <a href="mailto:miku2000@outlook.de?subject=[Riko.moe]">Mail me</a>
2017-06-21 19:50:36 +02:00
<!-- Footer ends -->
2015-02-28 21:48:37 +01:00
</html>