<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
header("Cache-Control: no-cache, must-revalidate" );
header("Pragma: no-cache" );
header("Content-Type: application/xml; charset=utf-8");
$xml = '<?xml version="1.0" ?><images>';
$directory = "testimages/";
if(file_exists($directory) && is_dir($directory)){
$handle = opendir($directory);
while(($file = readdir($handle))!== false){
if(!is_dir($file)){
$ext = substr($file, -3);
if($ext == "jpg" || $ext == "gif" || $ext == "png"){
$xml .= "<image>";
$xml .= "<fileName>".$file."</fileName>";
$xml .= "<caption>image caption</caption>";
$xml .= "</image>";
}
}
}
}
$xml .= '</images>';
echo $xml; |