Trying only to get images into my array

Hello!

I have this PHP code to get files from a folder on my server into an array, which I use in flash:


<?php
$dir = opendir("producers/");
while ($file = readdir($dir)) {
if ($file=="." or $file=="..") continue;
$string.= $file;
$string.= ", ";
}
echo "imgList=".$string;
?> 

The problem is that I just want images from that folder to get into the array, not all files! How can I do that? It’s enough to only handle jpg’s, though several file types are nicer =)

//regards, henxon