This is what I am using:
<div class="banner">
<?php if(get_post_meta($post->ID, 'banner', true)) : ?>
<img src="<?php echo get_post_meta($post->ID, 'banner', true); ?>" />
<?php else : ?>
<?php the_title(); ?>
<?php endif; ?>
<div>
and..
#banner {
clear:both;
width:980px;
overflow: hidden;
background: #F4F5F6;
-moz-border-radius:15px;
-webkit-border-radius: 15px;
border-radius: 15px; /* future proofing */
-khtml-border-radius:15px; /* for old Konqueror browsers */
padding:12px 0;
margin: 0 0 15px 0;
}
#banner img {
display: block; margin:0 auto;
}
I don't want a title displayed. If there is no img in the custom field can the div just not show?