you should not mix text and binary data (image) within single server response. because the browser is not able to process such data. The most simple way to show the image within the html is just printing the refernece to an image. The browser will fetch and place it by itself (with separate request as it always does).

for example if you store your image into some local_path/images/ folder which is visible from web as http://your_host/web_path/images/ and the image name is some_image.png