<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<?php
header('Content-type: image/jpeg');
// --- BEGIN CONFIGURATION ---
$path = 'ce/trips/arizona/';
$width = 175;
$height = 250;
// --- END CONFIGURATION ---
$files = @glob(realpath($path) . '/{.JPG,.jpg,.JPEG,.jpeg}', GLOB_BRACE);
if($files === FALSE) die();
$filename = $files[rand(0, count($files)-1)];
list($width_orig, $height_orig) = getimagesize($filename);
if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) $width_orig;
} else {
$height = ($width / $width_orig) $height_orig;
}
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
imagejpeg($image_p, null, 100);
?>
</body>
</html>