$d = $_ENV['DOCUMENT_ROOT']; #find out the directory the script is being executed from.
$d = $d."images"; # add your images directory, so the script know were to look (change as needed).
$dir = opendir($d); #open your images directory ready for action.
while ($f = readdir($dir)) # this loop is the main part.
{ #What it's doing is reading a file from the directory, while there is still one to read.
$size = getimagesize("images/$f"); # PHP function that extracts the size info from the file.
echo "

"; #print name of each file found.
}
?>