How to generate graphics dynamically on the web using Python CGI script?

Fuzzyman fuzzyman at gmail.com
Sat Jan 21 11:05:44 CET 2006


Steve Holden wrote:
> Luiz Geron wrote:
> > I don't have experience on this, but I think that you can make the
> > script return the image "contents" directly to the img tag, without
> > passing it to a img file, so you can use something like this:
> >
> > <img src="script_that_return_image_contents">
> >
> > wich saves some processing and I/O.
> >
> No it doesn't, because the script that generates the graphic is then a
> different script from the one that generates the referring HTML. I agree
> that scripted generation of the graphical content is a viable option
> that I overlooked, though it seems from the OP's inquiry that he already
> uses CGI to generate the HTML.
>

It doesn't save processing/IO, but it can still be done from teh same
script. Just pass parameters in the ``src='...'`` tag to tell the
script which image to output.

Either that or the script can generate static images (and maybe do a
cyclic cleanup) and put the correct URL into the image tags.

All the best,


Fuzzyman
http://www.voidspace.org.uk/python/index.shtml

> regards
>   Steve
> --
> Steve Holden       +44 150 684 7255  +1 800 494 3119
> Holden Web LLC                     www.holdenweb.com
> PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list