vabbè ho risolto..
codice:
$dir = dir(THUMB_DIR);
$counter = 0;
while($img = $dir->read()){ 
     if ($img != "." && $img != "..") {
         $nome = explode(".", $img);
         if ($nome[0] == $_GET["id"]){
               $counter++;
              echo '<td>[img]'.THUMB_DIR.'/'.$img.'[/img]</td></tr>';
             
            } 
         }
      }


if ($counter == 0) echo "<td>Nessuna immagine disponibile</td></tr>";
almeno, funziona!