codice:
list($height,$width)=@getimagesize("percorso/immagine.jpg");
$heigth+=20; // calcolo un po' di margine.
$width+=20;
echo "<a href=\"\" onclick=\"window.open('immagine.jpg','','height=".$height.",width=".$width."');return false\"><img src=\"thumbnail\"></a>";