<?php
 function uzanti($dosya)
        {
            $ext = strtolower(strrchr($dosya, '.'));
            $ext = substr($ext, 1);
            return $ext;
        }
        
        
$klasor = 'dosyalar';
$dizin = opendir ($klasor);


while ( gettype ( $bilgi = readdir( $dizin ) ) != boolean ) 
{
    if ( ( uzanti($bilgi)=='jpg' ) or ( uzanti($bilgi)=='jpeg' ) or ( uzanti($bilgi)=='gif' ) )
    {    
        echo '<img src = "'.$klasor.'/'.$bilgi.'"/><br/>';
    }

}  
?>
işinizi görecektir.