Hello and welcome to our community! Is this your first visit?
Register
Results 1 to 2 of 2
  1. #1
    Fanatic Enthusiast Niall's Avatar

    Join Date
    Aug 2007
    Posts
    3,298

    Exporting image list to XML

    Hi.

    I'm completely new to PHP and I'm wondering how to do something.
    Say I have a folder full of images, and when I run a php file it'll grab all the images in the folder, put them into a list and export them as an XML file. For example the output would be something like:

    <imagelist>
    <image>file.png</image>
    </imagelist>

    Could anybody provide me with an example of the code and a bit of a walkthrough of how to do it?

  2. #2
    Japanologist Wilio's Avatar

    Join Date
    Dec 2005
    Location
    Somewhere in time
    Posts
    5,561

    Re: Exporting image list to XML

    the source code from: http://www.laughing-buddha.net/jon/php/dirlist/ explains how to handle files into an array, which is a must.

    As to output it into an XML form.

    Code:
    $i=0;
    $length = count($result);
    
    echo '<imagelist>';
    
    while($i<=$length){
    echo '<image>'.$result[$i].'</image>';
    $i++
    };
    
    echo '</imagelist>';


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •