Curses, the HTML (just the img tag) was stripped out of that comment.

So, that should have read:
echo "<p><img src=\"$localfilename\" alt=\"QRCode for $url\"><br />Click here to visit $url</p>";