PHP (images folder) image Listing in Alphabetical Order?

Posted by user338233 on Stack Overflow See other posts from Stack Overflow or by user338233
Published on 2010-05-11T12:11:42Z Indexed on 2010/05/11 12:14 UTC
Read the original article Hit count: 177

Filed under:
|
|
|

Hello,

I'm having problems with a PHP script trying to list images alphabetically. I need this urgently and I have not much knowledge of PHP. I was trying to use scandir() but I'm not succeeding. Thanks for your help!!

Here is the code:

function listerImages($repertoire){

 $i = 0;
 $repertoireCourant = opendir('./'.$repertoire);
 while($fichierTrouve = readdir($repertoireCourant)){

  $fichierTemp = "";

  if($repertoire == '.')
   $fichierTemp = $fichierTrouve;
  else 
   $fichierTemp = $repertoire.'/'.$fichierTrouve;
  if(estUneImageValide($fichierTemp)){
   echo afficherPhoto($fichierTemp,$i);
   chmod($fichierTemp,0700);
  }

  $i++;
 }
}

© Stack Overflow or respective owner

Related posts about readdir

Related posts about scandir