Search the Community
Showing results for tags 'xml rss feed photo album'.
-
Hi there Sorry to just break in here with a dumb question. But I'm looking for a solution for days and nights without success. To be honest, I have no clue about programming, but I'm sure for most of you it's just a fingersnip with a smile... I have a php script that provides a simple XML file as a feed for a photo album(using cooliris with local images). It's only an output on the screen, so I can copy&paste it to a XML file. The problem is, that the tags in the output are written in this form: <thumbnail>thumbs/picture123.jpg</thumbnail> but for the photo album it's required like this: <media:thumbnail url="thumbs/picture123.jpg"/> The script looks like this: ---------------------------------------------------------------------------------------------- <?php $path_to_image_dir = 'pl_images'; // relative path to your image directory $path_to_thumbs_dir = 'pl_thumbs'; // relative path to your image directory $xml_string = <<<XML <?xml version="1.0" encoding="UTF-8"?> <items> </items> XML; $xml_generator = new SimpleXMLElement($xml_string); if ( $handle = opendir( $path_to_image_dir ) ) { while (false !== ($file = readdir($handle))) { if ( is_file($path_to_image_dir.'/'.$file) ) { $item = $xml_generator->addChild('item'); $item->addChild('thumbnail', $path_to_thumbs_dir.'/'.$file); $item->addChild('preview', $path_to_image_dir.'/'.$file); $item->addChild('category', 'photo'); $item->addChild('description', ' '); } } closedir($handle); } header("Content-Type: text/xml"); echo $xml_generator->asXML(); ?> ---------------------------------------------------------------------------------------------- The goal is to get a XML coding (for each image) like this: <item> <title></title> <description></description> <link>pics/picture123.jpg</link> <media:thumbnail url="thumbs/picture123.jpg"/> <media:content type="image/jpeg" url="pics/picture123.jpg"/> </item> Is there any change to change the syntax of the output accordingly? I think I manage everything, but just not the tag issue. Thank you so much for your help!!! Kind regards, Wolfgang