No of Images

11 Dec

<?php
$handle=opendir('.');
$strSought = "gif";
$num = 0;

while ($file = readdir($handle)) {
if ($strSought == substr($file, -3)) {
$num = $num + 1;
}
}
closedir($handle);

$handle=opendir('.');
echo "There are $num files!<br><br>";

echo"<table>";
echo "<tr><td colspan = 5>Files:</td></tr>";

while ($file = readdir($handle)) {
if ($strSought == substr($file, -3)) {
$size = GetImageSize($file);
$fullsize = intval(filesize($file)*.001);
echo "<tr><td><a href=$file>$file</a></td><td>  <b>$size[0]</b></td><td> by</td><td> <b>$size[1]</b>:</td><td> $fullsize kb</td></tr>";
}
}
closedir($handle);
echo"</table>";
?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: