Hallo,
ik heb en script (image gallery) met een output in XMl. het werkt prima maar, ik krijg steeds de irritante thumbs.db te zien. ik heb al gezocht het te verwijderen, want moeilijk is het niet om te controleren voor een thumbs.db, maar toch op de een of andere manier werkt het niet bij mij en geeft ie het telkens weer in een array[];
<?
//header("Content-Type: application/xml; charset=UTF-8");
//header("Content-type: text/xml");
$aantal_foto_per_pagina = 4;
$dirpath = "nieuwe map/";
$pagina = isset($_GET['pagina']) ? $_GET['pagina'] : 1;
$dir = opendir($dirpath);
$files = array();
while (false !==( $file = readdir($dir))) {
$localpath = $dirpath.$file;
if ($file != "." && $file != "..") {
//haal alles dat na de punt komt tijdelijk weg en plak het daarna weer eraan.
list($file, $ext) = explode(".", $file);
}
//is_file controleert of PATH://map bestaat
if (is_file($localpath)) {
$key = filemtime($localpath).md5($file);
//$files is array waarin de images komen
//$key is datum en tijd
$files[$key] = $file;
rsort($files);
}
}
// als de map leeg is
if(!empty($files))
{
foreach($files as $file)
{
if($file == "Thumbs.db" && $files == "Thumbs"){
}else{
//laat alle images zien.
$xml_output .= "\n<gallery>\n";
$xml_output .= "<picture>\n";
$xml_output .= "<image><a href=\"$dirpath$file\">$dirpath$file</a><br></image>\n";
$xml_output .= "</picture>\n";
$xml_output .= "</gallery>\n";
}
}
echo $xml_output;
}
?>
847 views