Here's the issue:
PHP:
<img src="http://www.".$dname."".$spath."/get/".$id.".jpg\">
is wrong. Told you you forgot something.
Should be:
<img src=\"http://www.".$dname."".$spath."/get/".$id.".jpg\">
You forgot the backslash before the quote before http, and PHP didn't like that.
Try the above and see if it works.
EDIT: I see what happened. Stupid MyBB when I post using PHP tags on the code strips out the slash before the http and the quote in front. So, that's a bit odd then.