$output = shell_exec( "ls -F | grep -v index.php" );
$files = array( ".." );
$tok = strtok( $output, " \t\n" );
array_push( $files, $tok );
while( $tok )
{
$tok = strtok( " \t\n" );
array_push( $files, $tok );
}
$i = 0;
while( $files[$i] )
{
$length = strlen( $files[$i] );
if( $files[$i][$length - 1] != "/" && $files[$i] != ".." )
{
$properties = getimagesize( $files[$i] );
$width = $properties[0];
$height = $properties[1];
if( $height > $width )
{
printf( " \n", $files[$i], "%", "%", $files[$i] );
}
else
{
printf( " \n", $files[$i], "%", "%", $files[$i] );
}
if( !( $i % 4 ) )
print( "
\n" );
}
else
{
printf( " %s\n", $files[$i], $files[$i] );
printf( "
\n" );
}
$i++;
}
?>