By html output I mean the source of the html page displayed in your browser as a result of running php code on server.
For Firefox: View–>Page source (or Ctrl-U)
For IE: View–>Source
Reply with the relevant html code to see where your problem is.
If you consider usefull here is a piece of code from one of my older projects. It works for me. Please note that $file is the file name and $thumb_name the thumb name already generated. If you are not using automatically generated thumbs you may replace with what you want.
<a href="/images/<?php echo ($file); ?>"><img src="/images/<?php echo ($thumb_name); ?>" border='0' target='_blank'">Click here to view full size picture.</a>