PHP menampilkan gambar dalam folder

PHP (gallery.php)

<table cellspacing="2" cellpadding="5">
<tr>
<?php
$folder = "./images/";
$handle = opendir($folder);
$i = 1;
$fileGambar = array('png', 'jpg', 'jpeg', 'gif');
while(false !== ($file = readdir($handle))){
    $fileAndExt = explode('.', $file);
    if(in_array(end($fileAndExt), $fileGambar)){
        echo '<td style="border:1px solid #000000;" align="center">
<img src="'.$folder.''.$file.'" width="100" /><br />'.$file.'
        </td>';

        if(($i % 4) == 0){
            echo '</tr><tr>';
        }
        $i++;
    }
}
?>
</tr>
</table>

2 komentar:

  1. kok cuma mncul namanya,,, gambarnya mana?
    kok gk di tampilin??

    BalasHapus
  2. tutorial lengkap nya dengan upload foto pakai database ada gak om?

    BalasHapus

Leave a message