PDA

View Full Version : Http server : send images



fitzy
28th October 2009, 20:48
Hi there!

I'd like to be able to create a server that can send images (stored in his memory) when a browser asks for it.

For example, if firefox wants to load this :

http://127.0.0.1/tree.png

I want my server to send the content of the image tree that he has in memory.

EDIT : I think QTextStream can do what I want, but I don't know how to use it.

Indeed, when I want to load my image in firefox, it says : "The image [...] cannot be displayed, because it contains errors"

Any idea :confused:

mgoetz
2nd November 2009, 12:04
You have to send a proper HTTP protocol response. This consists of a HTTP 200 line, the headers, a blank line and then the raw image data. Check the web for the exact format.

You don't need QTextStream at all.