[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatic picture gallery generation script for Art.arabeyes.org site



Forgot to attach the script.
So, here it is.

Ossama
------------ gallery.php ---------------
<?php
$dir = "pics/";
$d = dir($dir);
$count = 0;
$width = 4;
echo '<table width="100%" border="0" cellspacing="2"
celspacing="2"><tr>';
while ($entry = $d->read()) {
	if ($entry != "." && $entry != "..") {
		$count++;
		$filename = "$dir$entry";
		if (function_exists('getimagesize')) {
			$size = getimagesize($filename);
			$type = $size[2];
		} else {
			$type = exec("file -i ".$filename);
		}
		echo "<td align='center'><a href='$filename'>";
		if ($count < $width) {
			$html = "<img src='$filename' width='128'
height='102' border='0'></a><br>$type</td>";
			echo "$html\n";
		} else {
			echo "$html</tr><tr>\n";
			$count = 0;
		}
	}
}
echo"</table>";
$d->close();
?>
---------- END -------------

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com