Salve non so se si possa aprire un post solo per sentire dei pareri ma sono agli inizi in PHP ed è importante conoscere se si fa un buon script oppure no.
cmq ho fatto uno script che data una cartella controlla se ci sono jpeg e le inserisce i nomi in un'array.

Codice PHP:

<?php
$arrayJPG
= array();
$opendiropendir("images");
while(
$lettura readdir($opendir)){
    if(
is_file("images/".$lettura)){
    
$tempexplode("."$lettura);        
    if(
$temp[1] == "jpg" or $temp[1]=="jpeg"){
          
$arrayJPG[]=$lettura;
    }
     } 
}
for(
$a=0$a<count($arrayJPG); $a++){
    echo 
$arrayJPG[$a]."
"
;
}

?>