Replace views edit link with image

I wanted an edit icon on my views edit node links. Using the views field template I added the following to the template file: views-view-field--edit-node.tpl.php

<?php
  $output
= preg_replace(
   
'#(<a[^>]*>)[^<]*(</a>)#',
   
"$1". theme_image(path_to_theme(). '/images/icons/edit.png') ."$2",
   
$output
 
);
  print
$output;
?>

Now all my views have a nice edit icon for each node row. The image: Edit

And to go one step further, display the edit icon only when hovering the row this is added to the css.

.views-field-edit-node {
display:none;
}

.views-row:hover .views-field-edit-node {
display:block;
}