Hi
Just set your image icon array to use keys that relate to the file extension you have found in your directory reading script!
simple example...
$icons = array (
'gif' => array ( 'gif.gif', 'image/gif' ),
'doc' => array ( 'msdoc.gif', 'application/msword' ),
'unknown' => array ( 'ostrm.gif', 'application/octet-stream' )
);
while(reading_directory)
{
$ext = substr ( $file, ( strrpos ( $file, '.' ) + 1 ) );
$info = stat ();
if ( ! isset ( $icons[$ext] ) )
{
$ext = 'unknown';
}
// build the directory array for the display, makes sorting easy! -> array_multisort();
$files[] = array (
'name' => $file,
'path' => $dir . '/' . $file,
'size' => $info[7],
'date' => date ( 'r', $info[9] ),
'icon' => $icons[$ext][0],
'type' => $icons[$ext][1]
);
} // end while read dir
clearstatcache ();
abc