Ver Mensaje Individual
  #2 (permalink)  
Antiguo 12/03/2014, 19:18
Avatar de maxbrauer
maxbrauer
 
Fecha de Ingreso: marzo-2012
Ubicación: Mexico
Mensajes: 4
Antigüedad: 12 años, 2 meses
Puntos: 1
Respuesta: Como mostrar imagenes que hay en una carpeta?

public function getFileList($dirpath,$list_ignore,$list_allowed_ex t)
{
$filelist = array();
if ($handle = opendir(dirname ($dirpath)))
{
while (false !== ($file = readdir($handle)))
{
if (!is_dir($file) && !in_array($file,$list_ignore) && in_array(strtolower(end(explode('.',$file))),$list _allowed_ext))
{
$filelist[] = $file;
}
}
closedir($handle);
}

return $filelist;
}



$fileTypes = array ("jpg");
$list_ignore = array ('.','..');
$fileList = getFileList("./",$list_ignore,$fileTypes);

print_r($fileList);

Ya con eso tienes tu lista de archivos que solo son archivos JPG.

Referencia: http://stackoverflow.com/questions/8682206/retrieve-the-list-of-alla-jpg-file-of-a-directory