Hi Tommi, Thanks for this post, your side note was the information, I was searching for now 2 days.
I'm also new on tntnet and I really like it. On my search for a C++ web development toolkit, tntnet works best for me, because I like the template style more than Qt GUI style from witty. What I worked on the last days is a FileCache class, which loads and stores files if required. It worked well with text files, but not with image files. After removing all empty lines between the tags, it is working as expected. Another question is for me, what is the reason, if you are generating with "ecppc -b -m image/png -o b.cpp b.png" that the const char* rawData static const char* rawData = "\010\000\000\000KO\005\000\211PNG\015\n\032\n\000\000\000\015IHDR\000\000..... starts with "\010\000\000\000KO\005\000" and not with the first bytes of the file "\211PNG\015\n\032\n...."? I was not able to identify where it comes from and what it is? Hope you can bring in some light in the tunnel and thanks again for sharing this nice project with the rest of the world. Best regards, Sven On 29.12.2013 12:49, Tommi Mäkitalo wrote: > > Am 29.12.2013 10:06, schrieb Olaf Radicke: >> Hi Carsten, >> > ... >> >> ...on this site: >> http://www.tntnet.org/howto/static-howto.html >> >> >> greetings, >> >> Olaf >> (munich, germany) > Hi, > > yes, the static howto is a good place to start. > > To recap, what you need: > > reply.setContentType(std::string) > > sets the content type. The method > > reply.out() > > returns a reference to a std::ostream, where you write your data into. > So the shortest possible code is here: > > <%cpp> > reply.setContentType("image/jpeg"); > reply.out() << generateImageData(); > </%cpp> > > As a alternative you have a class, which generates the image data in the > output operator for std::ostream. But I'm sure that you know how to do that. > > One side note: you have to be careful with empty lines. You have to make > sure, your ecpp do not contain any empty lines outside the <%cpp> > section since it is written to the output stream and may corrupt your > image. But as a special feature of ecpp one line feed after the end tag > </%cpp> is not sent to the output stream. > > Tommi > > > > ------------------------------------------------------------------------------ > 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 ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Tntnet-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tntnet-general
