<?
  // *********************************************************************
  // AUTOR: Rafael Trindade da Silva (Mantus)
  // EMAIL: contato@rafaeltrindade.com.br
  // SITE : http://www.rafaeltrindade.com.br/dev
  // NOTA : Script que mostra imagens JPG e GIF de um diret�rio
  // *********************************************************************
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>MANTUS - Listando imagens JPG e GIF de um diretorio</title>
</head>

<body>

<?
// definimos o diretorio das imagens e abrindo o diret�rio
$strDiretorio = "G:\ARKANUS\RAFAELTRINDADE\WEBDEVELOPER";
$strDiretorioAbrir = opendir($strDiretorio);

echo "<div align=\"center\"><font color=\"#990000\" face=\"tahoma\" size=\"2\"><strong>Listando Imagens JPG e GIF de um diretorio<br><br>Diret�rio Escolhido: </strong>".$strDiretorio."</font></div><br><br>";

// Loop para listar arquivos
while ($strArquivos = readdir($strDiretorioAbrir)) {
	// N�o queremos diretorio ou subdiretorios
	if ($strArquivos != "." && $strArquivos != "..") {
		// Separamos cada arquivo
		$arrDados = explode(".", $strArquivos);
		// Testamos se a extens�o do arquivo � GIF ou JPG
		if ($arrDados[1] == "gif" || $arrDados[1] == "jpg") {
			echo "<strong>Nome da Imagem:</strong> " . $strArquivos; // Escrevendo o nome do arquivo
			echo "<br><img src=\"".$strDiretorio."/".$strArquivos."\"><br><br>"; // Printando a imagem
		}
	}
}
?>

</body>
</html>