I'm attempting to pull the very first image from the new posts my slider but getting one hell of the time looking to get results right this is exactly what I've to date

<div id="anicontainer">
    <div id="aninav">
    <li id="featuredtab"><a href="javascript:void(0);" rel="featuredouter"> </a></li>
    <li id="latesttab"><a href="javascript:void(0);" rel="latest"> </a></li>
    <li id="populartab"><a href="javascript:void(0);" rel="popular"> </a></li>

    <!-- Sub Menus container. Do not remove -->
    <div id="ani_inner">

    <div id="featuredouter" class="innercontent">

            <div id="featured" >

          <ul class="ui-tabs-nav">

$ani_featured_slide = get_option('x12_featured_slide');
$my_query = new WP_Query("cat=".$ani_featured_slide."&showposts=5");
while ($my_query->have_posts()) : $my_query->the_post(); ?>         

            <li class="ui-tabs-nav-item" id="nav-fragment-<?php the_ID(); ?>"><a href="#fragment-<?php the_ID(); ?>"><img src="<?php bloginfo('template_url'); ?>/thumb.php?src=<?php echo catch_that_image() ?>&amp;w=50&amp;h=44&amp;zc=1&amp;q=100" alt="" /></a></li>

<?php endwhile; ?>

          <?php $my_query = new WP_Query("cat=".$ani_featured_slide."&showposts=5");
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID; ?>
        <!-- Slide Content -->
        <div id="fragment-<?php the_ID(); ?>" class="ui-tabs-panel" style="">
            <img src="<?php bloginfo('template_url'); ?>/thumb.php?src=<?php echo catch_that_image() ?>&amp;w=368&amp;h=256&amp;zc=1&amp;q=100" alt="" />
             <div class="info" >
                <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
                <p><?php ani_content_limit(150, "Read More &rarr;"); ?></p>
<?php endwhile; ?>



    <div id="latest" class="innercontent">
    <?php $recent = new WP_Query("showposts=6"); while($recent->have_posts()) : $recent->the_post();?>
            <div class="latestpost">
                <?php if( get_post_meta($post->ID, "postimage", true) ): ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><img src="<?php bloginfo('template_url'); ?>/thumb.php?src=<?php echo catch_that_image() ?>&amp;w=70&amp;h=70&amp;zc=1&amp;q=100" class="latestpostimage" alt="<?php the_title(); ?>" /></a>
                <?php else: ?>
                    <a href="<?php the_permalink() ?>" rel="bookmark"><img class="latestpostimage" src="<?php bloginfo('template_url'); ?>/images/postimage.png" alt="<?php the_title(); ?>" /></a><?php endif; ?><h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                <div class="shortstory">
                <?php ani_content_limit(55, "Read More &rarr;"); ?>
                <?php endwhile; ?>

<div id="popular" class="innercontent">
<div id="populartags"><ul><li>
<?php wp_tag_cloud('smallest=9&largest=25&number=40'); ?>

Any my function for getting the look is

<?php  function catch_that_image() {
 global $post, $posts;
 $first_img = '';
 $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
 $first_img = $matches [1] [0];

 if(empty($first_img)){ //Defines a default image
 $first_img = "/images/default.jpg";
 return $first_img;


Am a new comer to php the majority of it was from google :( If anybody can easily see an issue this means alot in my experience cheers