Jump to content

Recommended Posts

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.

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 >
?>

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.