<?php 
require('./wp-config.php');
header('Content-type: text/xml; charset=utf-8');

function 
ssp_fetch_images($postid$size) {
    global 
$wpdb;
    return 
$wpdb->get_results("SELECT guid, post_title, post_content FROM $wpdb->posts WHERE post_parent = $postid AND post_mime_type = 'image/jpeg'");
}

if(isset(
$_GET['cat'])) {
$cat $_GET['cat'];
$query "cat=$cat&showposts=1000";
} else {
$query "showposts=1000";
?>
<gallery>
    <?php $gallery = new WP_Query($query);
    while (
$gallery->have_posts()) : $gallery->the_post(); ?>
    <album title="<?php echo htmlspecialchars($post->post_title); ?>" description="<?php echo htmlspecialchars($post->post_content); ?>">
        <?php $images ssp_fetch_images($post->ID);
        foreach(
$images as $image) { ?>
        <img src="<?php echo $image->guid?>" tn="<?php echo str_replace(".jpg"".thumbnail.jpg"$image->guid); ?>" title="<?php echo htmlspecialchars($image->post_title); ?>" caption="<?php echo htmlspecialchars($image->post_content); ?>" />
        <?php ?>
    </album>
    <?php endwhile; ?>
</gallery>