I’m just modifying your code please check. Hope it will help.
<?php $args = array( 'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $post->ID,
'order' => 'ASC' );
$i = 0;
$attachments = get_posts($args);
if ($attachments) {
foreach ( $attachments as $attachment ) {
if($i != 0){
$class="fantome";
}else{ $class="";}
$imgarr = wp_get_attachment_image_src($attachment->ID,'full');
/*---------------this will output your image and class------- */
echo '<img class="'.$class.'" src="'.$imgarr[0].'" />';
$i++;
}
}
?>