CGI Proplem displaying image

matthiasjanes matthiasjanes at gmx.net
Thu May 13 02:02:37 EDT 2004


> >
> > BUT What I want is that I display the image on an HTML page with text
> > together.
> 
> 
> You should have a script (if you don't want to have two different scripts),
> which would return an image or a page depending on its parameters,
> something like http://your.site.net/cgi-bin/witty_page.py?action=page to return
> """
> ...... Content-type: plain/text\n\n
> ......<img src="witty_page.py?action=image">
> ......
> """
> and http://your.site.net/cgi-bin/witty_page.py?action=image to return a picture.
> 

> 
>   sys.stdout.write( "Content-type: text/html\n\n" ) # yield html
> 
>   sys.stdout.write( "<html><head>%s%s</head>" % (style,title) )
>   sys.stdout.write( "<body>%s visits to <b>%s</b>"
>                     "<p><table border=1 cellspacing=0>\n" % (counter,name) )
>   sys.stdout.write( "<tr bgcolor='#C0FFFF'><td>%s</td><td>%s</td><td>%s</td></tr>\n"
>                     % ('Date','Time','IP') )

Thanks:

does anyone knows if the CGIHTTPServer.py module can handle this kind of requests.

Do I have to use the 'sys.stdout.write( something )'

or is it also good enough to use 'print (something)'

regards

Matthias Janes



More information about the Python-list mailing list