PeterPopper Posted December 17, 2009 Share Posted December 17, 2009 I have a folder with some images and I want to simply grab all the images and make an xml file. This is for a Flash photo gallery. The xml file will look like this: <?xml version="1.0" encoding="UTF-8" ?> <data > <image url="images/Lisa_Archer_1.jpg" thumb="images/thumbs/Lisa_Archer_thumb_1.jpg" /> </data> Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/185510-output-folder-contents-to-xml-file-with-php/ Share on other sites More sharing options...
premiso Posted December 17, 2009 Share Posted December 17, 2009 Look into using glob as that should get you what you want. Quote Link to comment https://forums.phpfreaks.com/topic/185510-output-folder-contents-to-xml-file-with-php/#findComment-979423 Share on other sites More sharing options...
PeterPopper Posted December 17, 2009 Author Share Posted December 17, 2009 I am just looking for a simple PHP code that opens a directory, get the names of all the files, and put the file names in the XML schema then do an echo, like this: <?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?> <data > <?php do{?> <image url="images/" . $imageName . " thumb="images/thumbs/ . $imageName . "_thumb" . '"' /> </data > ?> Quote Link to comment https://forums.phpfreaks.com/topic/185510-output-folder-contents-to-xml-file-with-php/#findComment-979460 Share on other sites More sharing options...
premiso Posted December 17, 2009 Share Posted December 17, 2009 Right, read up on glob. Given that you just posted the same question I take it you did not even bother to look into that function at all. As if you would have looked at the first example: <?php foreach (glob("*.txt") as $filename) { echo "$filename size " . filesize($filename) . "\n"; } ?> You would have an outline for what you need to do to get your images. Quote Link to comment https://forums.phpfreaks.com/topic/185510-output-folder-contents-to-xml-file-with-php/#findComment-979488 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.