returning a picture

Gerhard Häring gh_pythonlist at gmx.de
Fri Mar 8 10:31:12 EST 2002


Le 08/03/02 à 14:32, Peter Posselt Vestergaard écrivit:
> Hi
> I would like to be able to enter an URL to a python script in the src field
> of an img tag in html. The script is then supposed to return a picture which
> will be shown in the html-page.
> I am loading and editing the picture the Python Image Library (PIL) but how
> should I return/print it to do what I want?
 
In the CGI script that will return the image, just set the appropriate
content type and then write the image data, something like (for a jpeg
image):

print "Content-type: image/jpeg\n\n"
sys.stdout.write(imagedata)

Gerhard
-- 
This sig powered by Python!
Außentemperatur in München: 10.6 °C      Wind: 2.6 m/s




More information about the Python-list mailing list