atarichris
07-10-2008, 09:01 PM
Hi,
Im trying to write some PHP that writes an XML of jpegs in a folder BASED on the upload/modified date. I have a code that that does it in alpha-numeric order... can anyone help?
<?
$xml = '<?xml version="1.0"?'.'><images>';
$handle = opendir(".");
$doc = "gallery.xml";
$handle2 = fopen($doc, 'w') or die("can't open file");
while ( ($file=readdir($handle)) !== false ) {
if ( !is_dir($file) ){
$pic = @getimagesize($file);
if($pic != false && $pic[2] == 2){
$xml .= '<pic><image>/images/galleries/'.$file.'</image><width>'.$pic[0].'</width><height>'.$pic[1].'</height></pic>';
}
}
}
$xml .= "</images>";
fwrite($handle2, $xml);
fclose($handle2);
echo $xml;
?>
Im trying to write some PHP that writes an XML of jpegs in a folder BASED on the upload/modified date. I have a code that that does it in alpha-numeric order... can anyone help?
<?
$xml = '<?xml version="1.0"?'.'><images>';
$handle = opendir(".");
$doc = "gallery.xml";
$handle2 = fopen($doc, 'w') or die("can't open file");
while ( ($file=readdir($handle)) !== false ) {
if ( !is_dir($file) ){
$pic = @getimagesize($file);
if($pic != false && $pic[2] == 2){
$xml .= '<pic><image>/images/galleries/'.$file.'</image><width>'.$pic[0].'</width><height>'.$pic[1].'</height></pic>';
}
}
}
$xml .= "</images>";
fwrite($handle2, $xml);
fclose($handle2);
echo $xml;
?>