if (file_exists('album.php')) include('album.php');
if ($HTTP_GET_VARS["cmd"]=="loading") {
header("Content-type: image/png");
header("Expires: 31 Dec 2020 00:00:00 GMT");
$im = @imagecreate(640, 480)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagestring($im, 5, 200, 240, "Please wait, loading image...", $text_color);
imagepng($im);
imagedestroy($im);
exit;
}
$thumb_height = 80;
function proc_file($filename) {
global $thumb_height, $tocfile;
global $fname, $width, $height, $tn_filename;
if (preg_match("/^TN_/", $filename)) {
echo("Skipping $filename
");
return;
}
//echo("Processing $filename
");
echo("."); flush();
$im = @imagecreatefromjpeg($filename);
if (!$im) {
echo "error opening image: $filename
";
exit;
}
list($imgw, $imgh, $imgtype, $imgattr) = getimagesize($filename);
//echo("Image size : $imgw x $imgh
");
$ratio = $imgh / $thumb_height;
$thumbw = round($imgw / $ratio);
$thumbh = round($imgh / $ratio);
//echo("Thumbnail size: $thumbw x $thumbh
");
$thumb = @imagecreatetruecolor($thumbw, $thumbh);
$ret = @imagecopyresampled($thumb, $im, 0, 0, 0, 0, $thumbw, $thumbh, $imgw, $imgh);
$tn_filename = 'TN_'.$filename;
@imagejpeg($thumb, $tn_filename);
$fname[] = "\"$filename\"";
$width[] = $imgw;
$height[] = $imgh;
$tn_fname[] = "\"$tn_filename\"";
$tn_width[] = $thumbw;
$tn_height[] = $thumbh;
fwrite($tocfile, '$fname[] = "\"'.$filename.'\"";'."\n");
fwrite($tocfile, '$width[] = '.$imgw.';'."\n");
fwrite($tocfile, '$height[] = '.$imgh.';'."\n");
fwrite($tocfile, '$tn_fname[] = "\"'.$tn_filename.'\"";'."\n");
fwrite($tocfile, '$tn_width[] = '.$thumbw.';'."\n");
fwrite($tocfile, '$tn_height[] = '.$thumbh.';'."\n");
}
function make_toc() {
global $tocfile;
$list = array();
$dir = opendir('.');
$tocfile = fopen('album.toc', 'w');
fwrite($tocfile, "");
fclose($tocfile);
}
if (!is_file('album.toc')) {
make_toc();
echo("");
exit;
}
include('album.toc');
if (isset($album_name)) {
$album_caption = "- $album_name";
} else {
$album_caption = "";
}
?>
Photo Album
Loading images...