Hi I would like to make cgi-bin program which will make dynamic pictures.
I know how to make cgi program which would output simple html file

#include <iostream>
using namespace std;

int main(int argc, char* argv[])
{
    cout <<"Content-type: text/html\r\n\r\n" << endl;
    try
    {
            cout<<"<html><body><h1>Test</h1></body></html>"<<endl;
    }
    catch (exception e)
    {
        cout<<" Nemorem prikazati slike."<<endl;
    }
    return 0;
}

So how should I change this program that insted of html page I would output a jpeg image?
First I have to change frst output to: "Content-type: Image/jpeg\r\n\r\n"
After that ...

Recommended Answers

All 2 Replies

You have to learn how to write the file in jpeg format, as in this link and this wiki article

Is there any libary which can do that?
Or cgi program?
I don't want invent hot wather again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.