19 lines
422 B
PHP
Executable File
19 lines
422 B
PHP
Executable File
<?php
|
|
|
|
define('IMAGE_PATH', 'images/');
|
|
|
|
//background selection
|
|
$asImages = glob(IMAGE_PATH.'{*.jpg,*.png,*.jpeg,*.gif}', GLOB_BRACE);
|
|
$sRandomImagePath = $asImages[array_rand($asImages)];
|
|
|
|
//get type
|
|
$sFileInfo = pathinfo($sRandomImagePath);
|
|
$sExt = strtolower($sFileInfo['extension']);
|
|
if($sExt=='jpg')
|
|
{
|
|
$sExt = 'jpeg';
|
|
}
|
|
|
|
//display image
|
|
header("Content-type: image/$sExt");
|
|
echo file_get_contents($sRandomImagePath); |