Sorry I found a mistake in David’s code.
Can you try this instead?
<?php
if ( is_attachment() ) {?>
<div class="attach-navigation">
<span class="prev"><?php previous_image_link( 'thumbnail' );?></span>
<span class="next"><?php next_image_link( 'thumbnail' );?></span>
</div>
<?php
}
?>