Hi Tommi,

Thanks for your friendly follow up. Although I am replying quickly, 
don't let me interrupt your holidays :-) . I have received information 
to work on now, so I probably need some time to experiment.

On 29. des. 2013 14:06, Tommi Mäkitalo wrote:
> thank you for your feedback. We know, that documentation is not the
> strength of tntnet to say it friendly. We try to improve it step by step.

I think the current documentation is a good starting point. With some 
more comments added, and a little more context, it will be perfect.

> I have the impression, that you did not yet fully understand, how html
> works. So let me explain it a little.

Thank you, your impression is correct. I have in the past written some 
manual html pages ( http://arnholm.org/ , "powered by notepad") so I 
know basic html syntax, including image linking. The server part is new 
to me, but it is getting clearer with Tntnet and your explanations.

> If you want to display a image in a html page, you add a img-tag like
> that: <img src="/theimage.jpg">. The browser will do another request to
> the web server to load the image and display the image exactly, where
> the img tag is found. So from the webserver point of view there is just
> the request to the url "/theimage.jpg". This request do not care, where
> the image is displayed but just send the image back. The reply must
> contain a http header with the content type. In tntnet this is by
> default "text/html", which is really false for a jpg image. So you have
> to set the content type to a suitable value using reply.setContentType
> depending on the type of the image.

Understood. I presume that if more than one jpg image is presented on 
the same page, they are simply identified by the different URLs (file 
names) to be determined from the HttpRequest::getPathInfo() as in the 
example code Olaf posted.

I think I am slowly beginning to get it.

> When we think about dynamic images in tntnet, the url must map to a
> tntnet component, which sends the image back. Of course you can generate
> images to the file system and use static@tntnet to send the image back.
> But then they are more or less static images. The way I suggested, you
> can generate the images on the fly and send them back without touching
> the file system at all.

Indeed. Avoiding the file system is certainly what I want.

> After calling generateImageData you must not send a std::endl. std::endl
> would send a line feed, while the reply body must contain only the image
> data.

Ok, that is clear now.

> And I mean really outside <%cpp>-tags. Inside <%cpp> tags you can use as
> much empty lines as you wish since it is just c++ code, which do not
> affect the output. Everything outside the <%cpp> tags is sent to the
> output stream, which will corrupt your image. Hence you must take care
> not to output anything other than the data returned by the
> generateImageData function.

Ok, I see. Thanks for telling me, I will keep it in mind.

> I've once used gd to generate dynamic images. I have a example
> application here. I try to pack that to a archive and upload it to
> www.tntnet.org and send you the link. It may be helpful to you.

Wonderful, thanks a lot.

For your general information, I have some experience with wxWidgets ( 
http://www.wxwidgets.org/ ) for creating desktop GUIs, it can also be 
used in console applications. My plan is eventually to learn by creating 
a Tntnet web application reading data from an SQLite database and 
producing XY-graph images using wxWidgets. I have my own database API, 
so I will not use Tntdb for this.

Now I will experiment....

Best regards
Carsten Arnholm


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to