Help Combine These Two PHP Codes

here:

<?php
if ( has_post_format( 'image' )) {
?>
   <a href="https://wordpress.stackexchange.com/questions/21659/<?php the_permalink() ?>">
   <?php $image = catch_that_image();
   if( $image ) { ?>
      <img src="<?php echo get_template_directory_uri(); ?>/scripts/timthumb.php?src=<?php echo $image; ?>&amp;h=240&amp;w=280" class="index" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />
   <?php } ?>
   </a>
<?php
} ?>