All pastes #803297 Raw Edit

Something

public text v1 · immutable
·published 2007-12-01 01:35 UTC
rendered paste body
<?php

// Size of image to be displayed in main window
$height_width = 'height="112" width="150"';

$thumbpath = $_GET['id'] . '/' . thumbs;
$dir = $_GET['id'] . '/' . images;
//$handle = opendir($dir);

if (is_dir("$dir")) {
if ($handle = opendir($dir)) {
	while (false !== ($file = readdir($handle))) {
		if ($file != "." && $file != ".." && $file != "style.css" && $file != "index.php" && $file != "indexer.php" && $file != "Thumbs.db") {
			if (is_dir("$dir/$file"))
				$folder_array[] = ($file);
			else
				$file_array[] = ($file);
		}
	}
	closedir($handle);
}}

echo "<div class='style3' align='center'><font color='#0000ff' size='1'>";
if (count($file_array) == 0) {
echo "Sorry, no photos to display."; }
else {
echo count($file_array);
echo " images";
}
echo "</font>";

/* Script to display images. Checks in thumbs directory first then loads from images directory if it doesn't exist.
*/

echo "<div id='dwrap'>";
if ($file_array) {
	sort ($file_array);
	foreach ($file_array as $file) {
		echo "<div><a href=$dir/$file>";
$thumbfile = $_GET['id'] . '/' . thumbs . '/' . $file;
if (file_exists($thumbfile)) {
echo "<img src=$thumbfile $height_width alt=$file></a><br></div>";
} else { 
if (file_exists($thumbpath)) {
echo "<img src=$dir/$file $height_width alt=$file></a><br></div>";
} else { echo "<img src=$dir/$file $height_width alt=$file></a><br></div>";
}}
	}
}
echo "</div>";


?>