creating a custom template page for an attachment and how to link it from the main page

The code for the template page attachment.php

<?php
while ( have_posts() )
{
the_post();
$post_id = $post->ID;
?>
<article id="post-<?php the_ID(); ?>"    class= "article-single">
<header class="header">
<h1 class="title">
<?php the_title(); ?>
</h1>
</header>
<section class="texte" >
<?php the_content(); ?>
</section>
<?php echo wp_get_attachment_image( $post->ID, 'full' ); ?>
</article>

<section id="galerie-single">

<div class="clear"></div>
</section>
<?php } ?>

The problem is with the main file, the one that calls the attachment.php template.
Until now, I was using the template tag to link to the full size picture.

<?php
$datas_image =  wp_get_attachment_image_src( $attachment_id, 'full' );
$href = $datas_image	[0];
?>

<a class = "thumbnail"  href="<?php echo $href ?>">
<img class="galerie" src='<?php echo $imagette_url;?>'  height="<?php echo $imagette_height / 2; ?>" width="<?php echo $imagette_width / 2; ?>"  alt=" <?php echo $alt_text  ?>" >
</a>

This code gives me a blank page with the picture, with its address in the browser

But, if I use
$href = get_permalink( $attachment_id );
I 'm redirected to the right page