<?php
    header
( "Cache-control: public" );
    
$d = dir( 'images/' );
    while (
false !== ($entry = $d->read()))
    {
        if(
strstr( $entry, '.jpg' ) )
        {
            
$images[] = 'images/'.$entry;
        }
    }
    
$d->close();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="content-language" content="en-us" />
        <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
        <meta name="robots" content="noindex,nofollow" />
        <meta name="author" content="netlobo.com" />
        <title>Netlobo.com - Floating DIVs for photo gallery Example</title>
        <style type="text/css">
        body {
            text-align: center;
        }
        div.fgal {
            float: left;
            width: 150px;
            height: 175px;
            margin: 3px;
            background-color: #CCCCCC;
            font-family: Verdana, sans-serif;
            font-size: 10px;
            text-align: center;
            border: 1px solid #888888;
        }
        div.fgal img {
            margin: 3px auto;
            border: 0px;
        }
        </style>
    </head>
    <body>
<?php
    
for( $i = 0; $i < count( $images ); $i++ )
    {
?>
        <div class="fgal">
            <img src="<?php echo $images[$i]; ?>" alt="Gallery Image" />
            <p><?php echo str_replace( 'images/', '', $images[$i] ); ?></p>
        </div>
<?php    
    
}
?>
    </body>
</html>