i think that SPGM at one moment will do something like this
function hacer_dir ($directory) { // return the name of the files in an array
$d=dir ("$directory");
$n=0;
while ($entry=$d->read()) {
$archivos[$n]=$entry;
$n++;
}
$d->close();
return $archivos;
}
in the moment you have this array, simply you have to do string manipulation which each element of the array:
foreach (hacer_dir("./directory") as $onefile) {
if (substr ($onefile,0,3)=="ext") $cad="http://domain.com/";
echo "<img src=".$cad.$onefile.">";
}
you have many possibilities, maybe you can specify which domain the file is located depending on the 3 first characters:
$cad=substr ($onefile,0,3); and then search this 3 characters in a database to look what domain they relate to.