<?PHP 
$savefileImg="./../".$SYSD."/".$filename2."-image-list3.inc.php";
if (file_exists($savefileImg)){unlink($savefileImg);}

$folderImg=opendir ($imagesDirX);
while ($dataImg=readdir ($folderImg)){
$arrImg[] = $dataImg;
}
closedir($folderImg);
natcasesort ($arrImg);
foreach($arrImg as $resultImg)
if($resultImg != '.' && $resultImg != '..' && $resultImg != 'syslms')
{
if($imgFolder == ""){
$resultImgZ=$LMsRootV.$imagesF."/".$resultImg;
}else{
$resultImgZ=$LMsRootV.$imagesF."/".$resultImg;
}
$resultImgX="<option value='".$resultImgZ."'>".$resultImgZ."</option>";

$handle=fopen($savefileImg, "a+");
fwrite($handle,$resultImgX."\n");
fclose($handle);
$oldumask = umask(0);
chmod($savefileImg, 0644);
umask($oldumask);
}

if (file_exists($savefileImg)){}else{
copy("./../".$SYSI."/".$filenameD."/prg-img/image-list3.inc.php" , "./../".$SYSD."/".$filename2."-image-list3.inc.php");
}
?>