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

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

<section id="galerie-single">

<div class="clear"></div>
<?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.

$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  ?>" >

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