snowman.py

CGI scripts can deliver information other than text pages. For example, we can include an image tag of the form

    <img src="snowman.py">
and the server will call upon the python script snowman.py to deliver an image.


#!/usr/bin/python
print "Content-type: image/jpg"
print
f = open("cute-snowman.jpg","rb")
s = f.read()
print s,


Results


Maintained by John Loomis, updated Mon Feb 04 16:39:30 2008